#include <bits/stdc++.h>
#include <iostream>
using namespace std;

int n , m, player1 , player2;
int cards[100];

int main() {

    cin >> n ;
    for(int i=0;i<n;++i)
        cin >> cards[i];

    sort(cards,cards+n);

    for(int i=n-1;i>=0;--i)
    {
        if(m%2==0)
        player1+=cards[i];
        else
        player2+=cards[i];
        ++m;
    }

    cout << player1 - player2 << endl;

	return 0;
}
