#include <bits/stdc++.h>
using namespace std;
const long long N = 555555;
long long a[N];
long long n;
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cin >> n;
  long long sum = 0;
  for (long long i = (1); i <= (n); i++) {
    cin >> a[i];
    sum += a[i];
  }
  if (n == 1) {
    cout << a[1] << "\n";
    return 0;
  }
  sort(a + 1, a + n + 1);
  long long ans = max(max(sum - 2 * a[1], 2 * a[1] - sum),
                      max(2 * a[n] - sum, sum - 2 * a[n]));
  long long ans2 = 0, hasn = 0, hasp = 0;
  for (long long i = (1); i <= (n); i++) {
    if (a[i] >= 0) {
      hasp = 1;
    }
    if (a[i] <= 0) {
      hasn = 1;
    }
    ans2 += abs(a[i]);
  }
  if (hasp && hasn) {
    ans = max(ans, ans2);
  }
  cout << ans << "\n";
  return 0;
}
