#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  long long int a[n];
  for (int i = 0; i < n; ++i) cin >> a[i];
  if (n == 1) {
    cout << a[0];
    return 0;
  }
  long long int mi = 999999999999;
  long long int s = 0;
  int f1 = 0, f2 = 0;
  for (int i = 0; i < n; ++i) {
    if (a[i] < 0) f1 = 1;
    if (a[i] > 0) f2 = 1;
    s += abs(a[i]);
    mi = min(mi, abs(a[i]));
  }
  if (f1 && f2)
    cout << s;
  else
    cout << s - 2 * mi;
}
