#include <iostream>
#include <algorithm>
using namespace std;
int main()
{
    int n , bob = 0 , alice = 0;
    cin >> n;
    int arr[n];
    for (int i = 0 ; i < n ; i++)
        cin >> arr[i];
    sort(arr,arr+n);
    for (int i = n-1 ; i >= 0 ; i--){
        alice += arr[i];
        i--;
        if (i >= 0)
            bob += arr[i];
    }
    cout << alice-bob;
    return 0;
}