#include <bits/stdc++.h>
using namespace std;
long long int a[600000] = {0};
int main() {
  int n = 0;
  scanf("%d", &n);
  int i;
  int flag = 0;
  int zheng = 0;
  long long int mi = 10000000000;
  long long int ma = -10000000000;
  for (i = 1; i <= n; i++) {
    scanf("%lld", &a[i]);
    if (a[i] <= 0) {
      if (ma < a[i]) ma = a[i];
      flag = 1;
    }
    if (a[i] >= 0) {
      if (mi > a[i]) mi = a[i];
      zheng = 1;
    }
  }
  if (n == 1) {
    printf("%lld\n", a[1]);
    return 0;
  }
  long long int ans = 0;
  if (zheng == 0) {
    for (i = 1; i <= n; i++) ans -= a[i];
    ans = ans + 2 * ma;
  } else if (flag == 1) {
    for (i = 1; i <= n; i++) {
      if (a[i] > 0)
        ans += a[i];
      else
        ans -= a[i];
    }
  } else {
    for (i = 1; i <= n; i++) ans += a[i];
    ans = ans - 2 * mi;
  }
  printf("%lld\n", ans);
  return 0;
}
