import std.stdio;
import std.algorithm;
import std.array;
import std.conv;
import std.string;

void main() {
  int n = readln.chomp.to!int;
  auto a = readln.chomp.split.map!(to!int).array;

  a.sort!("a > b");

  int alice, bob;

  foreach(i, num; a) {
    if (i % 2) {
      bob += num;
    }
    else {
      alice += num;
    }
  }

  writeln(alice - bob);
}