#include <bits/stdc++.h>
using namespace std;
int n, num;
int pos, neg;
long long sum, minn = 1e9;
int main() {
  cin >> n;
  if (n == 1) {
    cin >> num;
    cout << num << endl;
  } else {
    for (int i = 1; i <= n; i++) {
      cin >> num;
      if (num > 0) pos++;
      if (num < 0) neg++;
      sum += (long long)abs(num);
      minn = min(minn, (long long)abs(num));
    }
    if (pos > 0 && neg > 0)
      cout << sum << endl;
    else
      cout << sum - minn * 2 << endl;
  }
  return 0;
}
