#include using namespace std; int main() { int n; cin >> n; vector c(n); for (int i = 0; i < n; i++){ cin >> c[i]; } sort(c.begin(), c.end()); long long a = accumulate(c.begin() + n / 2, c.end(), 0LL); long long b = accumulate(c.begin(), c.begin() + n / 2, 0LL); cout << abs(abs(a) - abs(b)) << endl; }