#include <bits/stdc++.h>
using namespace std;
const long long MAXN = 5e5 + 5;
const long long INF = 1e9 + 7;
const long long mod = 1e9 + 7;
long long n, ans = 0;
long long a[MAXN];
long long read() {
  long long s = 0, f = 0;
  char ch = getchar();
  while (!isdigit(ch)) f |= (ch == '-'), ch = getchar();
  while (isdigit(ch)) s = (s << 1) + (s << 3) + ch - '0', ch = getchar();
  return f ? -s : s;
}
signed main() {
  n = read();
  for (long long i = 1; i <= n; ++i) a[i] = read(), ans += abs(a[i]);
  if (n == 1) {
    printf("%lld", a[1]);
    return 0;
  }
  if (n == 2) {
    printf("%lld", max(a[1] - a[2], a[2] - a[1]));
    return 0;
  }
  sort(a + 1, a + n + 1);
  if (a[1] > 0) ans = ans - a[1] - a[1];
  if (a[n] < 0) ans = ans + a[n] + a[n];
  printf("%lld", ans);
  return 0;
}
