import std.stdio;
import core.stdc.stdio;
import std.array;
import std.conv;
import std.algorithm;
import std.range;

void main() {
    int n; scanf("%d",&n);
    int[] a; a.length=n;
    foreach(i; 0..n) scanf("%d", &a[i]);
    a.sort().reverse();
    int x, y;
    foreach(i, v; a) {
        if(i & 1) y += v;
        else x += v;
    }
    writeln(x - y);
}
