"use strict";

var main = function main(input) {
  var N = parseInt(input.split("\n")[0]);
  var a = input.split("\n")[1].split(" ").map(function (elem) {
    return parseInt(elem, 10);
  });
  var Alice = 0;
  var Bob = 0;
  a.sort(function (a, b) {
    a < b ? 1 : -1;
  }).forEach(function (element, i) {
    i % 2 == 0 ? Alice += element : Bob += element;
  });
  console.log(Alice - Bob);
};

main(require('fs').readFileSync('/dev/stdin', 'utf8'));