#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int n, c = 0;
  long long int x, a = 0, b = 0, ma = LLONG_MAX, mb = LLONG_MAX;
  cin >> n;
  if (n == 1) {
    cin >> x;
    cout << x << '\n';
    return 0;
  }
  for (int i = 0; i < n; ++i) {
    cin >> x;
    if (x >= 0) {
      c++;
      ma = min(ma, x);
      a += x;
    } else {
      mb = min(mb, -x);
      b += x;
    }
  }
  if (c == 0) {
    a -= mb;
    b += mb;
  }
  if (c == n) {
    a -= ma;
    b += ma;
  }
  cout << a - b << '\n';
}
