#include <bits/stdc++.h>
using namespace std;
const long long mod = 1e9 + 7;
const double eps = 1e-9;
const long long INF = (long long)1e15;
long long a[500050];
int main(void) {
  int n;
  while (~scanf("%d", &n)) {
    long long mx = -INF, mn = INF;
    long long sum = 0;
    for (int i = 1; i <= n; i++) {
      scanf("%lld", &a[i]);
      mx = max(mx, a[i]);
      mn = min(mn, a[i]);
      sum += abs(a[i]);
    }
    if (n == 1)
      printf("%lld\n", a[1]);
    else if (mn <= 0) {
      if (mx >= 0)
        printf("%lld\n", sum);
      else {
        printf("%lld\n", sum + (long long)2 * mx);
      }
    } else {
      printf("%lld\n", sum - (long long)2 * mn);
    }
  }
  return 0;
}
