#include <bits/stdc++.h>
using namespace std;
bool sortby(const pair<long long, long long> &a,
            const pair<long long, long long> &b) {
  if (a.first == b.first)
    return (a.second > b.second);
  else
    return (a.first > b.first);
}
void solve() {
  long long n, m = pow(10, 9), a, x = 0, y = 0, flag = 0, s = 0;
  cin >> n;
  if (n == 1) {
    cin >> a;
    cout << a;
  } else {
    for (long long i = 0; i < n; i++) {
      cin >> a;
      if (a == 0)
        flag = 1;
      else if (a < 0)
        x = 1;
      else
        y = 1;
      a = abs(a);
      s = s + a;
      m = min(m, a);
    }
    if ((x == 1 && y == 1)) flag = 1;
    if (flag == 0) s = s - 2 * m;
    cout << s;
  }
}
signed main() {
  long long t = 1;
  while (t--) {
    solve();
  }
}
