#include <bits/stdc++.h>
const int MAX_VAL = int(1e9);
const int MIN_VAL = -int(1e9);
int main() {
  int n;
  scanf("%d", &n);
  if (n == 1) {
    int x;
    scanf("%d", &x);
    printf("%d", x);
    return 0;
  }
  long long s = 0, minEl = MAX_VAL, maxEl = MIN_VAL;
  for (int i = 0; i < n; i++) {
    long long x;
    scanf("%I64d", &x);
    s += std::abs(x);
    minEl = std::min(minEl, x);
    maxEl = std::max(maxEl, x);
  }
  printf("%I64d", s - std::abs(minEl) - std::abs(maxEl) + maxEl - minEl);
  return 0;
}
