#include<cstdio>
#include<algorithm>
int main() {
	int n, a[100], i;
	scanf("%d", &n);
	for (i = 0; i < n; i++)scanf("%d", &a[i]);
	std::sort(a, a + n);
	int d = 0;
	for (i = 0; i < n; i++) {
		if (i % 2 == 0)d += a[n-i-1];
		else d -= a[n-i-1];
	}
	printf("%d", d);
	return 0;
}