#include "iostream"
#include "vector"
using namespace std;

int main(void) {
  int N;
  cin >> N;
  vector<int> a;
  for (int i = 0; i < N; i++) {
    int t;
    cin >> t;
    a.push_back(t);
  }

  sort(a.begin(), a.end(), greater<int>());
  int A = 0, B = 0;
  for (int i = 0; i < N; i++) {
    (i & 1 ? B : A) += a[i];
  }

  cout << A - B << endl;
}
