#include <iostream>
#include <algorithm>
using namespace std;
int main() {
	int n,i,m=0,f=1,a[101];
	cin >> n;
	for(i=0;i<n;i++) {
		cin >> a[i];
	}
	sort(a,a+n);
	for(i=n-1;i>=0;i--)	{
		m+=f*a[i];
		f=-f;
	}
	cout << m << endl;
	return 0;
}
