function Main(input){
    var nums = input.split('\n')[1].split(' ').map((n) => parseInt(n, 10)).sort((a,b) => b-a);
    var alice = 0;
    var bob = 0;
    nums.forEach((num,index) =>{
      if (index %2 === 0){
          alice += num;
      }else {
          bob += num;
      }
    })
    console.log(alice-bob);
}
Main(require('fs').readFileSync('/dev/stdin', 'utf8'));
