#include <bits/stdc++.h>
#pragma GCC optimize("O3")
using namespace std;
int main() {
  long long ans = 0, n, a[500001], mini = 1e9;
  bool pos = false, neg = false;
  cin >> n;
  for (int i = 0; i < n; i++)
    cin >> a[i], pos |= (a[i] >= 0), neg |= (a[i] <= 0), ans += abs(a[i]),
        mini = min(mini, abs(a[i]));
  if (!pos || !neg) ans -= mini * 2;
  if (n == 1) ans = a[0];
  cout << ans;
  return 0;
}
