#include <iostream>
#include <algorithm>
using namespace std;
int main() {
    int N, a[100], ans = 0;
    cin >> N;
    for (int i = 0; i < N; i++) cin >> a[i];
    sort(a, a + N);
    for (int i = 0; i < N; i++) ans += (i % 2) ? -a[N-i-1] : a[N-i-1];
    cout << ans << endl;
}