#include <bits/stdc++.h>
using namespace std;
int aa[500005];
int main() {
  int n;
  cin >> n;
  long long sum = 0;
  long long maxn = -1e10;
  long long minn = 1e10;
  int fu = 0;
  int zheng = 0;
  for (int i = 1; i <= n; i++) {
    cin >> aa[i];
    if (aa[i] < 0) {
      sum += (-1) * aa[i];
      fu = 1;
    } else {
      sum += aa[i];
      zheng = 1;
    }
    if (aa[i] > maxn) maxn = aa[i];
    if (aa[i] < minn) minn = aa[i];
  }
  if (fu == 0) {
    sum -= 2 * minn;
  } else if (zheng == 0) {
    sum += 2 * maxn;
  }
  if (n == 1)
    cout << aa[1];
  else
    cout << sum;
  return 0;
}
