#include <bits/stdc++.h>
using namespace std;
int n;
int main() {
  long long ans = 0;
  scanf("%d", &n);
  int bo1 = 0, bo2 = 0, x, Mn = 1000000007;
  for (int i = 1; i <= n; i++) {
    scanf("%d", &x);
    ans += abs(x);
    if (x >= 0) bo1 = 1;
    if (x < 0) bo2 = 1;
    Mn = min(Mn, abs(x));
  }
  if (n == 1)
    printf("%d\n", x);
  else if (bo1 && bo2)
    printf("%I64d\n", ans);
  else
    printf("%I64d\n", ans - 1ll * 2 * Mn);
  return 0;
}
