#include <bits/stdc++.h>
using namespace std;
int dx[] = {0, 1, 0, -1};
int dy[] = {1, 0, -1, 0};
int ddx[] = {1, 0};
int ddy[] = {1, 1};
int n;
vector<long long int> vec;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cin >> n;
  long long int ans = 0;
  long long int sum = 0;
  long long int mini = INT_MAX;
  int aa = 0, bb = 0;
  for (int i = 0; i < n; i++) {
    long long int a;
    cin >> a;
    vec.push_back(a);
    if (a >= 0)
      aa++;
    else
      bb++;
    sum += abs(a);
    mini = min(mini, abs(a));
  }
  if (n == 1) {
    cout << vec[0] << "\n";
    return 0;
  }
  if (aa and bb)
    cout << sum << "\n";
  else if ((!aa and bb) or (aa and !bb))
    cout << sum - mini * 2 << "\n";
  return 0;
}
