import "dart:io";

main(){
  int n = int.parse(stdin.readLineSync());
  List<int> a = stdin.readLineSync().split(" ").map((x) => int.parse(x)).toList();

  a.sort((x, y) => y - x);
  int alice = 0;
  int bob = 0;
  for (int i = 0; i < n; i++){
    if (i % 2 == 0) alice += a[i];
    else bob += a[i];
  }
  print(alice - bob);
}
