#include <bits/stdc++.h>
using namespace std;
int n;
const int maxn = 5e5 + 555;
long long a[maxn];
bool a1 = false, a2 = false;
int32_t main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  cin >> n;
  for (int i = 1; i <= n; i++) cin >> a[i];
  if (n == 1) {
    cout << a[1] << endl;
    return 0;
  }
  long long minn = *min_element(a + 1, a + 1 + n),
            maxx = *max_element(a + 1, a + 1 + n), sum = 0;
  for (int i = 1; i <= n; i++) {
    sum += a[i] > 0 ? a[i] : -a[i];
    if (a[i] > 0) a1 = true;
    if (a[i] < 0) a2 = true;
  }
  if (!a1)
    cout << sum + maxx + maxx << endl;
  else if (!a2)
    cout << sum - minn - minn << endl;
  else
    cout << sum << endl;
  return 0;
}
