#include <bits/stdc++.h>
using namespace std;
inline long long read() {
  register long long x(0), f(1);
  register char c(getchar());
  while (c > '9' || c < '0') f = c == '-' ? -1 : 1, c = getchar();
  while (c >= '0' && c <= '9') x = x * 10 + c - 48, c = getchar();
  return f * x;
}
const long long N = 1000000;
long long flag1, flag2, a[N], n, mi = 2147483647, sum;
signed main() {
  n = read();
  register long long i;
  if (n == 1) {
    cout << read();
    return 0;
  }
  for (i = 1; i <= n; i++) {
    a[i] = read();
    if (a[i] >= 0)
      flag1 = 1;
    else
      flag2 = 1, a[i] = -a[i];
    sum += a[i];
    mi = min(mi, a[i]);
  }
  if (flag1 && flag2)
    cout << sum;
  else
    cout << sum - 2 * mi;
  return 0;
}
