Array.prototype.remove = function(from, to) {
  var rest = this.slice((to || from) + 1 || this.length);
  this.length = from < 0 ? this.length + from : from;
  return this.push.apply(this, rest);
};
function sortNumber(a,b) {
    return a - b;
}
function Main(input){
 input=input.split("\n")
 var cardsN = parseInt(input[0])
 var cards = input[1].split(" ").map(x=>parseInt(x))
 
 cards.sort(sortNumber)
 var A=0, B=0
 var isA = true
 while(cards.length!=0) {
   if(isA) {
    A += cards[0]
    cards.remove(0)
   } else {
    B += cards[0]
    cards.remove(0)
   }
   isA = !isA
 }
  console.log(A-B)
}

Main(require("fs").readFileSync("/dev/stdin", "utf8"));
