#include <bits/stdc++.h>
using namespace std;
const int maxn = 5e+5 + 5;
int a[maxn], n, m;
long long ans;
bool pos, neg;
inline int rd() {
  int x = 0, f = 0;
  char c = getchar();
  while (!isdigit(c)) {
    if (c == '-') f = 1;
    c = getchar();
  }
  while (isdigit(c)) x = x * 10 + (c ^ 48), c = getchar();
  return f ? -x : x;
}
int main() {
  n = rd();
  for (int i = 1; i <= n; ++i) {
    a[i] = rd();
    ans += abs(a[i]);
    if (a[i] >= 0) pos = true;
    if (a[i] < 0) neg = true;
  }
  if (n == 1) {
    cout << a[1] << endl;
    return 0;
  }
  if (pos && !neg) {
    sort(a + 1, a + 1 + n);
    ans -= (long long)a[1] * 2ll;
    cout << ans << endl;
    return 0;
  }
  if (!pos && neg) {
    sort(a + 1, a + 1 + n);
    ans += (long long)a[n] * 2ll;
    cout << ans << endl;
    return 0;
  }
  if (pos && neg) {
    cout << ans << endl;
    return 0;
  }
  return 0;
}
