#include <bits/stdc++.h>
using namespace std;
using LL = long long;
vector<LL> v;
int main()
{
ios::sync_with_stdio(false);
cin.tie(0);
int n;
if(!(cin >> n)) return 0;
v.resize(n);
for(int i = 0;i < n;i++)
{
cin >> v[0];
}
v.resort();
LL x = 0;
for(int i = 1;i <= n;i++)
{
if(i / 2 != 0) x += v[i-1];
else if(i / 2 == 0) x -= v[i-1];
}
cout << x << "\n";
return 0;
}

京公网安备 11010502036488号