#include <bits/stdc++.h>
void run(void) {
  int n;
  scanf("%d", &n);
  int *a = (int *)malloc(sizeof(int) * n);
  int i;
  for (i = 0; i < n; i++) scanf("%d", a + i);
  if (n == 1) {
    printf("%d\n", a[0]);
    return;
  }
  int p = 0;
  int z = 0;
  int m = 0;
  for (i = 0; i < n; i++) {
    if (a[i] == 0)
      z = 1;
    else if (a[i] > 0)
      p = 1;
    else
      m = 1;
  }
  if (z || (p && m)) {
    long long int ans = 0;
    for (i = 0; i < n; i++) {
      ans += ((a[i]) > (0) ? (a[i]) : -(a[i]));
    }
    printf("%lld\n", ans);
  } else {
    long long int ans = 0;
    int min = 1000000001;
    for (i = 0; i < n; i++) {
      min = ((min) < (((a[i]) > (0) ? (a[i]) : -(a[i])))
                 ? (min)
                 : (((a[i]) > (0) ? (a[i]) : -(a[i]))));
      ans += ((a[i]) > (0) ? (a[i]) : -(a[i]));
    }
    printf("%lld\n", ans - 2 * min);
  }
}
int main(void) {
  run();
  return 0;
}
