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