#include <bits/stdc++.h>
using namespace std;
long long read() {
  long long s = 0, w = 1;
  char ch = getchar();
  while (ch < '0' || ch > '9') {
    if (ch == '-') w = -1;
    ch = getchar();
  }
  while (ch >= '0' && ch <= '9') s = s * 10 + ch - '0', ch = getchar();
  return s * w;
}
long long n;
long long a[1000010];
long long ans;
signed main() {
  cin >> n;
  for (long long i = 1; i <= n; i++) a[i] = read();
  sort(a + 1, a + n + 1);
  if (n == 1) {
    cout << a[1];
    return 0;
  }
  if (n == 2) {
    cout << a[2] - a[1];
    return 0;
  }
  if (n == 3) {
    ans = 1ll * a[3];
    if (a[2] > 0)
      ans += a[2];
    else
      ans += -a[2];
    ans -= a[1];
    cout << ans;
    return 0;
  }
  if (a[n] < 0) {
    for (long long i = 1; i <= n - 1; i++) ans -= a[i];
    ans += a[n];
    cout << ans;
    return 0;
  }
  if (a[2] > 0) {
    for (long long i = 2; i <= n; i++) ans += a[i];
    ans -= a[1];
    cout << ans;
    return 0;
  }
  for (long long i = 1; i <= n; i++) {
    if (a[i] > 0)
      ans += a[i];
    else
      ans += -a[i];
  }
  cout << ans;
  return 0;
}
