#include <bits/stdc++.h>
using namespace std;
const int INF = 0x3f3f3f3f;
const long long LINF = 0x3f3f3f3f3f3f3f3fll;
const long double pi = acos(-1);
const int MOD = 1e9 + 7;
const int N = 1e6 + 10;
long long dp[N][2];
int v[N], n;
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) scanf("%d", &v[i]);
  long long resp = 0;
  for (int i = 1; i <= n; i++) {
    if (v[i] > 0)
      resp += v[i];
    else
      resp -= v[i];
  }
  if (n == 1) {
    cout << v[1] << endl;
  } else {
    int menor = INF;
    int maior = -INF;
    for (int i = 1; i <= n; i++) {
      maior = max(maior, v[i]);
      menor = min(menor, v[i]);
    }
    if (maior < 0) resp += 2 * maior;
    if (menor > 0) resp -= 2 * menor;
    cout << resp << endl;
  }
}
