function Main (input) {
  input = input.split('\n');
  len = Number(input[0]);
  cards = input[1].split(' ').map(num => Number(num));
  cards.sort((a, b) => {return b-a});
  human = [0, 0];
  for (i = 0; i < len; i++) {
    human[i%2] += cards.shift();
  }
  console.log(human[0] - human[1]);
}
 
Main(require('fs').readFileSync('/dev/stdin', 'utf8'));