#include <bits/stdc++.h>
using namespace std;
void fast_io() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
}
const long long MAXN = 5e5 + 228;
long long insects[MAXN];
signed main() {
  fast_io();
  long long n;
  cin >> n;
  bool fl_neg = false;
  long long ans = 0;
  for (long long i = 0; i < n; i++) {
    cin >> insects[i];
    ans += abs(insects[i]);
    if (insects[i] < 0) {
      fl_neg = true;
    }
  }
  if (n == 1) {
    cout << insects[0];
    return 0;
  }
  if (!fl_neg) {
    ans -= *min_element(insects, insects + n) * 2;
  } else {
    long long maxx = *max_element(insects, insects + n);
    ans -= abs(maxx);
    ans += maxx;
  }
  cout << ans;
  return 0;
}
