#include<cstdio>
#include<algorithm>
using namespace std;
int n,ans,a[101];
bool cmp(int x,int y)
{
	return x>y;
}
int main()
{
	scanf("%d",&n);
	for (int i=1;i<=n;i++)scanf("%d",&a[i]);
	sort(a+1,a+n+1,cmp);
	for (int i=1;i<=n;i+=2)ans+=(a[i]-a[i+1]);
	printf("%d",ans);
}