#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  long long n, sum = 0, mx = -1000000007, mn = 1000000007;
  cin >> n;
  vector<long long> a(n + 1, -1000000007);
  for (int i = 1; i <= n; i++) {
    cin >> a[i];
    sum += abs(a[i]);
  }
  if (n == 1) {
    cout << a[1];
    return 0;
  }
  sort(a.begin(), a.end());
  sum -= abs(a[n]);
  sum -= abs(a[1]);
  cout << sum - a[1] + a[n];
}
