#include <bits/stdc++.h>
using namespace std;
template <class T>
void print(const T niz[], const int siz) {
  for (int i = 0; i < siz; i++) cout << niz[i] << " ";
  cout << endl;
}
int n;
long long niz[500005];
bool use[500005];
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  cin >> n;
  bool pos = 0, neg = 0;
  for (int(i) = (0); (i) <= (n - 1); ++(i)) {
    cin >> niz[i];
    if (niz[i] > 0)
      pos = 1;
    else if (niz[i] < 0)
      neg = 1;
    else if (niz[i] == 0) {
      if (pos == 0)
        pos = 1;
      else
        neg = 1;
    }
  }
  if (n == 1) {
    cout << niz[0];
    return 0;
  }
  long long zb = 0, mini = 1e9;
  for (int(i) = (0); (i) <= (n - 1); ++(i)) {
    niz[i] = abs(niz[i]);
    zb += abs(niz[i]);
    mini = min(mini, niz[i]);
  }
  if (pos & neg)
    cout << zb;
  else
    cout << zb - 2 * mini;
  return 0;
}
