#include <bits/stdc++.h>
using namespace std;
const int MAX_N = 2000000;
long long a[MAX_N];
long long tree[MAX_N];
void init(int v, int l, int r) {
  if (l == r - 1) {
    tree[v] = a[l];
    return;
  }
  int m = (l + r) / 2;
  init(2 * v + 1, l, m);
  init(2 * v + 2, m, r);
  tree[v] = max(tree[2 * v + 1], tree[2 * v + 2]);
}
long long min_(int v, int l, int r, int a, int b) {
  if (l >= b || r <= a) {
    return (long long)1e9 + 1;
  }
  if (a <= l && r <= b) {
    return tree[v];
  }
  int m = (l + r) / 2;
  return min(min_(2 * v + 1, l, m, a, b), min_(2 * v + 2, m, r, a, b));
}
int main() {
  int n;
  cin >> n;
  bool b, b1;
  b = false;
  b1 = false;
  long long bd = -1;
  int ind = -1;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
    if (a[i] > 0) b = true;
    if (a[i] < 0) b1 = true;
    if (bd < 0 || abs(a[i]) < bd) {
      bd = abs(a[i]);
      ind = i;
    }
  }
  if (n == 1) {
    cout << a[0] << endl;
    exit(0);
  }
  long long ans = 0;
  for (int i = 0; i < n; i++) {
    if (i != ind) ans += abs(a[i]);
  }
  if (b && b1)
    ans += abs(a[ind]);
  else
    ans -= abs(a[ind]);
  cout << ans << endl;
  return 0;
}
