#include <bits/stdc++.h>
using namespace std;
void fun() {}
const long long int N = 1e5 + 7;
const long long int mod = 1e9 + 7;
signed main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  ;
  fun();
  long long int tests = 1;
  while (tests--) {
    long long int n;
    cin >> n;
    long long int a[n];
    long long int sum = 0;
    for (long long int i = 0; i < n; i++) cin >> a[i], sum += abs(a[i]);
    if (n == 1) return cout << a[0], 0;
    long long int x = *min_element(a, a + n);
    long long int y = *max_element(a, a + n);
    if (y < 0) {
      sum -= 2 * (abs(y));
    }
    if (x > 0) {
      sum -= 2 * x;
    }
    cout << sum;
  }
  cerr << "time elapsed : " << 1.0 * clock() / CLOCKS_PER_SEC << " sec \n";
  return 0;
}
