#include "bits/stdc++.h" using namespace std; using ll = long long; using P = pair; const ll INF = (1LL << 61); ll mod = 998244353; signed main() { ios::sync_with_stdio(false); cin.tie(0); ll N; cin >> N; vectorc(N); for (int i = 0; i < N; i++)cin >> c[i]; sort(c.begin(), c.end()); if (N % 2 == 0) { ll a = 0, b = 0; for (int i = 0; i < N / 2; i++) { a += c[i]; } for (int i = N / 2; i < N; i++) { b += c[i]; } cout << max(abs(a),abs(b)) - min(abs(a), abs(b)) << endl; } else { ll a = 0, b = 0; for (int i = 0; i < N / 2; i++) { a += c[i]; } for (int i = N / 2; i < N; i++) { b += c[i]; } ll t = 0, d = 0; for (int i = 0; i <= N / 2; i++) { t += c[i]; } for (int i = N / 2 + 1; i < N; i++) { d += c[i]; } cout << max(abs(b) - abs(a), abs(t) - abs(d)) << endl; } return 0; }