import std.algorithm;
import std.array;
import std.conv;
import std.math;
import std.range;
import std.stdio;
import std.string;
import std.typecons;

T read(T)() { return readln.chomp.to!T; }
T[] reads(T)() { return readln.split.to!(T[]); }
alias readint = read!int;
alias readints = reads!int;

void main() {
    readint;
    auto xs = readints;
    xs.sort();
    xs.reverse();

    int alice = 0;
    int bob = 0;
    for (int i = 0; i < xs.length; i += 2) {
        alice += xs[i];
        if (i + 1 < xs.length)
            bob += xs[i + 1];
    }
    writeln(alice - bob);
}