"use strict";

function main(input){
  const args= input.split('\n');
  const N= parseInt(args[0],10),
  a= args[1].split(' ').map(n=>parseInt(n,10));

  var Alice=0,Bob=0;

  a.sort((a,b)=>(a<b?1:-1)).forEach((x, i) => {
    (i%2===0)?Alice+=x:Bob+=x;
  });

  console.log(Alice-Bob);

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