#include <bits/stdc++.h>
using namespace std;
int n, a[500010], mi, pos, mx;
long long sum = 0;
int main() {
  scanf("%d", &n);
  mi = 1e9 + 1;
  mx = -1e9 - 1;
  int ok = 1, ok2 = 1;
  for (int i = 1; i <= n; i++) {
    scanf("%d", &a[i]);
    if (a[i] <= 0) ok = 0;
    if (a[i] > 0) ok2 = 0;
    sum += (a[i] > 0 ? a[i] : -a[i]);
    if (mi > a[i]) {
      mi = a[i];
      pos = i;
    }
    mx = max(mx, a[i]);
  }
  if (n == 1) {
    printf("%d", a[1]);
    return 0;
  }
  if (n == 2) {
    long long ans = a[2] > a[1] ? a[2] - a[1] : a[1] - a[2];
    printf("%lld", ans);
    return 0;
  }
  if (ok2) {
    sum -= -mx * 2ll;
    printf("%lld", sum);
    return 0;
  }
  if (ok) {
    sum -= 2ll * mi;
    printf("%lld", sum);
  } else {
    printf("%lld", sum);
  }
  return 0;
}
