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


		
}
