#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n;
  cin >> n;
  long long a[n + 5];
  bool checka = 0, checkd = 0;
  if (n == 1) {
    int tmp;
    cin >> tmp;
    cout << tmp;
    return 0;
  }
  for (long long i = 0; i < n; i++) {
    cin >> a[i];
    if (a[i] < 0) checka = 1;
    if (a[i] > 0) checkd = 1;
  }
  long long sum = 0;
  if (checka == 1 && checkd == 1) {
    for (long long i = 0; i < n; i++) sum += abs(a[i]);
    cout << abs(sum);
  } else if (checka == 1 && checkd == 0) {
    long long nmax = -1e9;
    for (long long i = 0; i < n; i++) nmax = max(nmax, a[i]);
    for (long long i = 0; i < n; i++) {
      if (a[i] == nmax) {
        a[i] = abs(a[i]);
        break;
      }
    }
    long long sum1 = 0;
    for (long long i = 0; i < n; i++) sum1 += a[i];
    cout << abs(sum1);
  } else {
    long long nmin = 1e9;
    for (long long i = 0; i < n; i++) nmin = min(nmin, a[i]);
    for (long long i = 0; i < n; i++) {
      if (a[i] == nmin) {
        a[i] = -a[i];
        break;
      }
    }
    long long sum2 = 0;
    for (long long i = 0; i < n; i++) sum2 += a[i];
    cout << abs(sum2);
  }
}
