#include <bits/stdc++.h>
using namespace std;
const int M = 1e9 + 7;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int n;
  cin >> n;
  vector<int> A(n);
  for (int i = 0; i < n; ++i) {
    cin >> A[i];
  }
  bool pos = false, neg = false;
  int mn = 1e9;
  long long sum = 0;
  for (int i : A) {
    if (i >= 0) {
      pos = true;
    } else {
      neg = true;
    }
    i = abs(i);
    mn = min(mn, i);
    sum += i;
  }
  if (n == 1) {
    cout << A[0] << "\n";
  } else if ((pos && neg)) {
    cout << sum << "\n";
  } else {
    cout << (sum - 2 * mn) << "\n";
  }
  return 0;
}
