const stdin=require("fs").readFileSync("/dev/stdin", "utf8");
const argv=stdin.split("\n");
const round=Number(argv[0]);
const cards=argv[1].split(" ").map(c=>Number(c));

cards.sort().reverse();//cardを降順に並べ替え

const alice=cards.filter((a,idx)=>(idx%2)==0).reduce((sum,a)=>sum+a);//偶数枚目を合計
const bob=cards.filter((a,idx)=>(idx%2)==1).reduce((sum,a)=>sum+a);//奇数枚目を合計

console.log(alice-bob);