#include <bits/stdc++.h>
using namespace std;
long long a[500005];
int main() {
  memset(a, 0, sizeof(a));
  int n;
  scanf("%d", &n);
  int neg = 0;
  int pz = 0;
  long long minx = INT_MAX;
  long long sum = 0;
  for (int i = 1; i <= n; i++) {
    scanf("%lld", &a[i]);
    if (a[i] < 0) {
      neg++;
    } else {
      pz++;
    }
    sum += abs(a[i]);
    minx = min(minx, abs(a[i]));
  }
  long long ans = 0;
  if (n == 1) {
    ans = a[1];
  } else if (pz == n || neg == n) {
    ans = sum - 2 * minx;
  } else {
    ans = sum;
  }
  printf("%lld\n", ans);
  return (0);
}
