#include <bits/stdc++.h>
using namespace std;
const int inf = 0x3f3f3f3f;
int main() {
  int n, a;
  scanf("%d", &n);
  int minn = inf, maxn = -inf;
  long long sum1 = 0, sum2 = 0;
  for (int i = 0; i < n; ++i) {
    scanf("%d", &a);
    minn = min(minn, a);
    maxn = max(maxn, a);
    if (a >= 0)
      sum1 += a;
    else
      sum2 += a;
  }
  if (n == 1) {
    printf("%d\n", a);
  } else {
    if (minn >= 0) sum1 -= minn, sum2 += minn;
    if (maxn < 0) sum2 -= maxn, sum1 += maxn;
    printf("%lld\n", sum1 - sum2);
  }
  return 0;
}
