#include using namespace std; #include using namespace atcoder; #define ll long long #define rep(i, n) for (ll i = 0; i < (ll)(n); i++) using mint = modint998244353; random_device rnd; mt19937 mt(rnd()); int RandInt(int a, int b) { return a + mt() % (b - a + 1); } const int dx[4] = {0, 1, 0, -1}; const int dy[4] = {1, 0, -1, 0}; // int TIMELIMIT = 2.8 * CLOCKS_PER_SEC; // int ti = clock(); // while (clock() - ti < TIMELIMIT) { ll n; int main(){ cin>>n; vector a(n); rep(i,n)cin>>a[i]; sort(a.begin(),a.end()); dequedq; rep(i,n)dq.push_back(a[i]); bool flag=true; ll first_sum=0; ll second_sum=0; rep(i,n){ if(flag){ first_sum+=dq.back(); dq.pop_back(); flag=false; }else{ second_sum+=-1*dq.back(); dq.pop_back(); flag=true; } } cout<