"use strict";
// import bigInt from 'big-integer'

const Main = input => {
  input = input.trim().split("\n");
  const cardsNum = input[0];
  const cards = input[1].split(" ").sort((a, b) => b - a);

  let alice = 0;
  let bob = 0;
  for (let i = 0; i < cardsNum; i++) {
    if (i % 2 === 0) alice += parseInt(cards[i], 10);
    else bob += parseInt(cards[i], 10);
  }

  console.log(alice - bob);
};

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