#include <bits/stdc++.h>
using namespace std;
signed main() {
  long long n;
  cin >> n;
  long long arr[n];
  for (long long i = 0; i < n; i++) {
    cin >> arr[i];
  }
  long long c = 0;
  long long d = 0;
  long long e = 0;
  long long h;
  long long g;
  for (long long i = 0; i < n; i++) {
    if (arr[i] >= 0) {
      c++;
    } else {
      d++;
    }
  }
  if (n == 1) {
    cout << arr[0];
    return 0;
  }
  if (c >= 1 && d >= 1) {
    for (long long i = 0; i < n; i++) {
      e = e + abs(arr[i]);
    }
  } else if (c == 0 || d == 0) {
    h = abs(arr[0]);
    for (long long i = 0; i < n; i++) {
      e = e + abs(arr[i]);
      h = min(h, abs(arr[i]));
    }
    e = e - 2 * h;
  }
  cout << e;
  return 0;
}
