function Main(input) {
  input = input.split("\n");

  var N = ~~input[0];
  var A = input[1];
  var a = A.split(" ").map(x => ~~x);

var Cards = function(cards){
  this.cards = cards;
}

var Human = function(){
  this.point = 0;
};

Human.prototype = {
  selectCard: function(cards){
    var maxCard = Math.max(...cards);
    this.point = this.point + maxCard;
    for(var i =0; i< cards.length; i++){
      if(cards[i] == maxCard){
        cards[i] = 0;
        return;
      }
    }
  }
}

var allice = new Human();
var bob = new Human();
var cards = new Cards(a);

for(var i = 0; i<N; i++){
  allice.selectCard(cards.cards);
  bob.selectCard(cards.cards);
}

console.log(allice.point - bob.point);

}


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