#include <bits/stdc++.h>
using namespace std;
const int N = 5e5 + 1e3;
long long a[N], b[N];
bool fg;
int cnt, tt;
long long ans, kk = 9223372036854775807;
long long su(int a, int b) {
  int c = abs(a - b);
  return a + b - c;
}
long long minn(long long a, long long b) {
  if (a < b) return a;
  return b;
}
long long abss(long long a) {
  if (a < 0) return -a;
  return a;
}
int main() {
  int n;
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) {
    scanf("%I64d", &a[i]);
    if (a[i] < 0) fg = 1;
    if (a[i] > 0) cnt++;
    if (a[i] == 0) tt++;
  }
  if (n == 1) {
    printf("%lld\n", a[1]);
    return 0;
  }
  if (fg == 1) {
    if (cnt != 0 || tt != 0) {
      for (int i = 1; i <= n; i++) {
        ans += abss(a[i]);
      }
      printf("%I64d", ans);
      return 0;
    }
    for (int i = 1; i <= n; i++) {
      ans += abss(a[i]);
      kk = minn(kk, abss(a[i]));
    }
    printf("%I64d", ans - kk * 2);
    return 0;
  }
  for (int i = 1; i <= n; i++) {
    ans += a[i];
    kk = minn(kk, a[i]);
  }
  printf("%I64d", ans - kk * 2);
}
