#include <bits/stdc++.h>
using namespace std;
int n;
vector<long long> a;
int main() {
  cin >> n;
  a.resize(n);
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  long long sum_abs = 0;
  long long min_abs = 2000000000;
  bool geq = false, leq = false;
  for (int i = 0; i < n; i++) {
    geq = geq | (a[i] >= 0);
    leq = leq | (a[i] <= 0);
    sum_abs += abs(a[i]);
    min_abs = min(min_abs, abs(a[i]));
  }
  if (n == 1) {
    cout << a[0];
  } else {
    if (geq && leq) {
      cout << sum_abs;
    } else {
      cout << sum_abs - 2 * min_abs;
    }
  }
  return 0;
}
