#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, b = 0, c = 0;
  cin >> n;
  int a[n];
  for (int i = 0; i < n; i++) cin >> a[i];
  sort(a, a + n);
  for (int i = 0; i < n; i++) {
    if (i % 2 == 0)
      b = b + a[i];
    else
      c = c + a[i];
  }
  cout << (c - b);
  return 0;
}
