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