#include <bits/stdc++.h>
int n, max = INT_MIN, min = INT_MAX;
long long ans;
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) {
    int tmp;
    scanf("%d", &tmp);
    max = std::max(max, tmp);
    min = std::min(min, tmp);
    ans += abs(tmp);
  }
  if (n == 1) {
    printf("%d\n", max);
    return 0;
  } else if (n == 2) {
    printf("%d\n", abs(max - min));
    return 0;
  }
  if (max < 0) {
    printf("%lld\n", ans - 2 * abs(max));
  } else if (min > 0) {
    printf("%lld\n", ans - 2 * abs(min));
  } else
    printf("%lld", ans);
  return 0;
}
