#include <bits/stdc++.h>
long long d[500001];
int main() {
  int i, n;
  long long sum = 0;
  scanf("%d", &n);
  for (i = 1; i <= n; i++) scanf("%lld", &d[i]);
  std::stable_sort(d + 1, d + n + 1);
  if (n == 1)
    sum = d[1];
  else if (d[1] > 0) {
    for (i = 2; i <= n; i++) sum += d[i];
    sum -= d[1];
  } else if (d[n] < 0) {
    for (i = 1; i < n; i++) sum += -d[i];
    sum += d[n];
  } else {
    for (i = 1; i <= n; i++) sum += (d[i] > 0) ? d[i] : -d[i];
  }
  printf("%lld\n", sum);
  return 0;
}
