#include <bits/stdc++.h>
using namespace std;
const long long int N = 5e5 + 10;
long long int a[N];
int32_t main() {
  long long int n;
  cin >> n;
  bool pos = false, neg = false;
  long long int minn = 1e18;
  long long int sum = 0;
  for (long long int i = 0; i < n; i++) {
    cin >> a[i];
    sum += abs(a[i]);
    minn = min(minn, abs(a[i]));
    if (a[i] >= 0) pos = true;
    if (a[i] <= 0) neg = true;
  }
  cout << (n == 1 ? a[0] : sum - (2 * minn) * (!pos || !neg)) << endl;
}
