"use strict";
    
const main = arg => {
    const N     = arg.split("\n")[0];
    const cards = arg.split("\n")[1].split(" ").sort((a,b)=>b-a).map(n=>parseInt(n));
    let alice = 0;
    let bob = 0;
    
    for(let i in cards) {
        if(i % 2 === 0) {
            alice += cards[i];
        } else {
            bob += cards[i];
        }
    }
    console.log(alice - bob);
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'));