#include<iostream>
#include<algorithm>
#include<functional>
using namespace std;
 
int n,a,b,i,s[100];
int main()
{ 
cin >> n;
for(i=0;i<n;i++){
cin >> s[i];
}
sort(s,s+n, greater<int>());
for(i=0;i<n;i++){
if(i%2==0){a=a+s[i];
}else{b=b+s[i];
}
}
printf("%d",a-b);
}