#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);
  puts("");
}
const long long N = 5e5 + 5;
long long a[N], ans, minn = 1e9 + 5;
bool flag1 = 0, flag2 = 0;
signed main() {
  long long n = read();
  if (n == 1) writeln(read()), exit(0);
  for (register long long i = 1; i <= n; i++) {
    a[i] = read();
    ans += abs(a[i]);
    minn = min(minn, abs(a[i]));
    if (a[i] <= 0) flag1 = 1;
    if (a[i] >= 0) flag2 = 1;
  }
  if (flag1 != flag2)
    writeln(ans - (minn << 1));
  else
    writeln(ans);
}
