#include <bits/stdc++.h>
using namespace std;
const long long maxN = 1e6 + 5;
const long long inf = 1e10;
const long long mod = 1e9 + 7;
long long n;
long long a[maxN];
long long kt[maxN];
int main() {
  ios_base::sync_with_stdio(0);
  cin >> n;
  for (long long i = 1; i <= n; i++) cin >> a[i];
  if (n == 1) {
    cout << a[1];
    return 0;
  }
  long long sum = 0;
  for (long long i = 1; i <= n; i++) sum += abs(a[i]);
  long long maxx = -1e18, minn = 1e18;
  for (long long i = 1; i <= n; i++) {
    maxx = max(maxx, a[i]);
    minn = min(minn, a[i]);
  }
  if (minn >= 0)
    sum -= minn * 2;
  else if (maxx <= 0)
    sum -= abs(maxx) * 2;
  cout << sum;
  return 0;
}
