#include <bits/stdc++.h>
using namespace std;
long long n, a[500001], checkp, checkn;
int main() {
  cin >> n;
  long long MIN = 1e18, res = 0;
  for (int i = 1; i <= n; i++) {
    cin >> a[i];
    checkp |= (a[i] >= 0);
    checkn |= (a[i] <= 0);
    res += abs(a[i]);
    MIN = min(MIN, abs(a[i]));
  }
  if (n == 1) {
    cout << a[n];
    return 0;
  }
  (checkp && checkn) ? cout << res : cout << res - (MIN << 1);
}
