#include <bits/stdc++.h>
using namespace std;
long long arr[10005000];
signed main() {
  long long n;
  cin >> n;
  if (n == 1) {
    long long qwq;
    cin >> qwq;
    cout << qwq << endl;
    return 0;
  }
  long long flag1 = 0;
  long long flag2 = 0;
  long long sum1 = 0;
  long long minx = 1 << 30;
  for (long long i = 1; i <= n; i++) {
    cin >> arr[i];
    sum1 += abs(arr[i]);
    if (arr[i] < 0) {
      flag1 = 1;
    } else if (arr[i] > 0) {
      flag2 = 1;
    }
    minx = min(minx, abs(arr[i]));
  }
  if (flag1 && flag2) {
    cout << sum1;
  } else {
    cout << sum1 - abs(minx) * 2;
  }
  return 0;
}
