#include <bits/stdc++.h> using namespace std; using ll = long long; int main() { int n; cin >> n; vector<int> a(n); for (int i = 0; i < n; i++) cin >> a[i]; sort(a.begin(), a.end()); ll y = 0, x = 0; for (int i = 0; i < n / 2; i++) { y += -a[i]; } for (int i = n / 2; i < n; i++) { x += a[i]; } cout << x - y << endl; }