#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  vector<int> lol;
  int maxx = INT_MIN;
  int mini = INT_MAX;
  long long sum = 0;
  for (int y = 0; y < n; y++) {
    int k;
    cin >> k;
    lol.push_back(k);
    sum = sum + abs(k);
    if (maxx < k) {
      maxx = k;
    }
    if (mini > k) {
      mini = k;
    }
  }
  if (mini == maxx && n == 1) {
    cout << mini << endl;
  } else if (mini < 0 && maxx < 0) {
    sum = sum - 2 * abs(maxx);
    cout << sum << endl;
  } else if (mini > 0 && maxx > 0) {
    sum = sum - 2 * abs(mini);
    cout << sum << endl;
  } else {
    cout << sum << endl;
  }
}
