#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n;
  cin >> n;
  long long a[n];
  long long pos = false, neg = false, zer = false;
  for (long long i = 0; i < n; i++) {
    cin >> a[i];
    if (a[i] > 0) {
      pos = true;
    }
    if (a[i] < 0) {
      neg = true;
    }
    if (a[i] == 0) {
      zer = true;
    }
  }
  long long ans = 0;
  if (n != 1) {
    if (pos == true && neg == true) {
      for (long long i = 0; i < n; i++) {
        ans += abs(a[i]);
      }
      cout << ans << endl;
    } else if ((pos == true && neg == false) || (pos == false && neg == true)) {
      if (zer == true) {
        for (long long i = 0; i < n; i++) {
          ans += abs(a[i]);
        }
        cout << ans << endl;
      } else {
        long long sub = LLONG_MAX;
        for (long long i = 0; i < n; i++) {
          ans += abs(a[i]);
          sub = min(sub, abs(a[i]));
        }
        cout << ans - 2 * sub << endl;
      }
    } else if (pos == false && neg == false) {
      cout << 0 << endl;
    }
  } else {
    cout << a[0] << endl;
  }
}
