#include <bits/stdc++.h>
using namespace std;
const int maxn = 5e5 + 5;
const int mod = 1e9 + 7;
long long a[maxn];
int main() {
  int n;
  scanf("%d", &n);
  long long sum = 0, ma = -1e10, mi = 1e10;
  for (int i = 1; i <= n; i++) {
    scanf("%lld", &a[i]);
    ma = max(ma, a[i]);
    mi = min(mi, a[i]);
    sum += abs(a[i]);
  }
  if (n == 1)
    printf("%lld\n", a[1]);
  else if (n == 2)
    printf("%lld\n", max(a[1] - a[2], a[2] - a[1]));
  else {
    if (mi > 0)
      sum -= mi * 2;
    else if (ma < 0)
      sum += ma * 2;
    printf("%lld\n", sum);
  }
  return 0;
}
