#include <iostream>
#include <queue>
using namespace std;
priority_queue<int> pa;
int main(){
	int n,i,a,sum=0,d=1;
	cin >> n;
	for(i=0;i<n;i++){
		cin >> a;
		pa.push(a);
	}
	while(!pa.empty()){
		sum+=d*pa.top();
		pa.pop();
		d=-d;
	}
	cout << sum << endl;
	return 0;
}
