#include<iostream>
#include<algorithm>
using namespace std;

int main(){
  int n,a[110],sum=0;
  cin>>n;
  for(int i=0;i<n;i++) cin>>a[i];
  sort(a,a+n,greater<int>());
  for(int i=0;i<n;i++){
    if(i%2==0) sum+=a[i];
    else sum-=a[i];
  }
  cout<<sum;
}
