function main(arg) {
  const args = arg.split('\n');
  const N = parseInt(args[0], 10);
  const sorted = args[1].split(' ').map(v => parseInt(v)).sort((a, b) => b - a);
  let alice = 0;
  let bob = 0;

  sorted.forEach((v, i)=>{
    if((i+1) % 2 == 0) {
      bob += v;
    } else {
      alice += v;
    }
  });
  console.log(alice - bob);
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'));
