#include <bits/stdc++.h>
using namespace std;
void solve() {}
int32_t main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long n;
  vector<long long> pos, neg;
  long long ok1 = 0, ok2 = 0;
  cin >> n;
  long long arr[n], a = 0;
  for (long long i = 0; i < (n); i++) {
    cin >> arr[i];
    if (arr[i] == 0) {
      ok1 = 1;
      ok2 = 1;
    } else if (arr[i] > 0) {
      pos.push_back(arr[i]);
      ok2 = 1;
    } else {
      neg.push_back(arr[i]);
      ok1 = 1;
    }
    a += abs(arr[i]);
  }
  sort(arr, arr + n);
  sort((pos).begin(), (pos).end());
  sort((neg).begin(), (neg).end(), greater<long long>());
  if (ok1 && ok2)
    cout << a << "\n";
  else if (ok2) {
    if (pos.size() == 1) {
      cout << pos[0] << "\n";
    } else {
      cout << a - 2 * abs(pos[0]) << "\n";
    }
  } else {
    if (neg.size() == 1) {
      cout << neg[0] << "\n";
    } else {
      cout << a - 2 * abs(neg[0]) << "\n";
    }
  }
  return 0;
}
