#include <bits/stdc++.h>
using namespace std;
inline long long read() {
  long long x = 0;
  char ch = getchar();
  bool f = 0;
  for (; !isdigit(ch); ch = getchar())
    if (ch == '-') f = 1;
  for (; isdigit(ch); ch = getchar()) x = x * 10 + ch - '0';
  return f ? -x : x;
}
void write(long long x) {
  if (x < 0) putchar('-'), x = -x;
  if (x >= 10) write(x / 10);
  putchar(x % 10 + '0');
}
void writeln(long long x) {
  write(x);
  putchar('\n');
}
void writep(long long x) {
  write(x);
  putchar(' ');
}
long long const N = 1e6 + 3;
long long n, a[N];
signed main() {
  n = read();
  long long ans = 0;
  for (long long i = 1; i <= n; i++) a[i] = read(), ans += a[i];
  if (n == 1) {
    writeln(a[1]);
    return 0;
  }
  sort(a + 1, a + n + 1);
  if (a[1] <= 0) {
    for (long long i = 1; i < n && a[i] <= 0; i++) ans -= 2 * a[i];
  } else {
    ans -= 2 * a[1];
  }
  writeln(ans);
}
