
function Main(input) {
    var N = parseInt(input[0], 10);
    var a = input.slice(1)
        .map(e => parseInt(e, 10))
        .sort((a, b) => {
            return b - a;
        });

    var alice = 0;
    var bob = 0;

    for (var i = 0; i < N; i++) {
        if (i % 2 === 0) {
            alice += a[i];
        } else {
            bob += a[i];
        }
    }

    console.log(alice - bob);
}

Main(require("fs").readFileSync("/dev/stdin", "utf8").trim().split(/\n|\s/));