#include <bits/stdc++.h>
using namespace std;
const int N = 1e6 + 9, mod = 1e9 + 7;
long long n, a, b, sum, mn = mod, x;
int main() {
  cin >> n;
  if (n == 1) {
    cin >> x;
    return cout << x, 0;
  }
  for (int i = 0; i < n; i++) {
    cin >> x;
    sum += abs(x);
    if (x >= 0)
      a = 1;
    else
      b = 1;
    mn = min(mn, abs(x));
  }
  if (!(a && b)) sum -= 2 * mn;
  cout << sum;
}
