#include <bits/stdc++.h>
using namespace std;
const int MAX_N = 500000;
const int INF = 1 << 30;
int as[MAX_N];
int main() {
  int n;
  scanf("%d", &n);
  for (int i = 0; i < n; i++) scanf("%d", as + i);
  if (n == 1) {
    printf("%d\n", as[0]);
    return 0;
  }
  long long sum = 0;
  int k = 0, mina = INF, maxa = -INF;
  for (int i = 0; i < n; i++) {
    if (as[i] > 0)
      sum += as[i];
    else
      sum -= as[i], k++;
    mina = min(mina, as[i]);
    maxa = max(maxa, as[i]);
  }
  if (k == 0)
    sum -= mina * 2;
  else if (k == n)
    sum += maxa * 2;
  printf("%lld\n", sum);
  return 0;
}
