#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  long long int a[n];
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  if (n == 1) {
    cout << a[0] << endl;
    return 0;
  }
  long long int neg = 0, pos = 0, mn = a[0], sum = 0, mx = a[0];
  for (int i = 0; i < n; i++) {
    if (a[i] >= 0) {
      pos++;
    } else {
      neg++;
    }
    if (a[i] < mn) {
      mn = a[i];
    }
    if (a[i] > mx) {
      mx = a[i];
    }
    sum = sum + abs(a[i]);
  }
  if (neg > 0 && pos > 0) {
    cout << sum;
  } else {
    if (pos == 0) {
      sum = sum - 2 * abs(mx);
    } else {
      sum = sum - 2 * abs(mn);
    }
    cout << sum;
  }
  cout << endl;
  return 0;
}
