const stdin=require("fs").readFileSync("/dev/stdin", "utf8");
const argv=stdin.split("\n");
const round=Number(argv[0]);
const cards=argv[1].split(/\s+/).map(a=>Number(a));
 
const sortedCards=cards.sort((a,b)=>a-b).reverse();//cardを降順に並べ替え
 
const alice=sortedCards.reduce((sum,a,idx)=>(sum+((idx%2)==0 ? a : 0)),0);//偶数枚目を合計
const bob=sortedCards.reduce((sum,a,idx)=>(sum+((idx%2)==1 ? a : 0)),0);//奇数枚目を合計
 
console.log(alice-bob);