function main(argString) {
	var cards = argString.split('\n')[1].split(' ')
    	.map(v => Number(v) || 0).sort().reverse();
	var sub = 0;
	for (var i = 0; i < cards.length; i += 2) {
		sub += cards[i] - (cards[i + 1] || 0);
	}
	console.log(sub);
}

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