process.stdin.resume();
process.stdin.setEncoding('utf8');


function Main(input) {
    var inputs = input.split("\n");
    
    var A = inputs[1].split(" ").map(e => parseInt(e)).sort((a, b) => a - b);
    
    var Alice = 0, Bob = 0;
    
    for (var i = 0; i < parseInt(inputs[0]); i++) {
        if (i % 2 === 0) {
            Alice += A.pop();
        } else {
            Bob += A.pop();  
        }
    }
    
    console.log(Alice - Bob);
}

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