#include <bits/stdc++.h>
using namespace std;
const int MAXN = 5e5 + 7;
const long long infint = 1e13 + 7;
long long a[MAXN], b[MAXN];
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  long long n;
  cin >> n;
  for (int i = 0; i < n; i++) cin >> a[i];
  if (n == 1) return cout << a[0], 0;
  long long smpos = 0, smneg = 0, zero = 0;
  for (int i = 0; i < n; i++)
    if (a[i] > 0)
      smpos += a[i];
    else if (a[i] < 0)
      smneg += -a[i];
    else
      zero++;
  if (zero) return cout << smpos + smneg, 0;
  if (smpos > 0 && smneg > 0) return cout << smpos + smneg, 0;
  if (smpos) {
    long long mn_pos = infint;
    for (int i = 0; i < n; i++)
      if (a[i] > 0) mn_pos = min(mn_pos, a[i]);
    cout << smpos - 2 * mn_pos;
    return 0;
  }
  long long mx_neg = -infint;
  for (int i = 0; i < n; i++)
    if (a[i] < 0) mx_neg = max(mx_neg, a[i]);
  cout << smneg - 2 * abs(mx_neg);
}
