#include <bits/stdc++.h>
using namespace std;
void READ() {}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  READ();
  int n;
  while (cin >> n) {
    multiset<long long> slimes;
    for (int i = 1; i <= n; ++i) {
      long long x;
      cin >> x;
      slimes.insert(x);
    }
    if (n == 1) {
      cout << *(slimes.begin()) << endl;
      return 0;
    }
    auto l = slimes.begin();
    auto r = slimes.end();
    r--;
    long long snack = abs(*l - *r);
    l++;
    for (; l != r; l++) {
      snack += abs(*l);
    }
    cout << snack << endl;
  }
  return 0;
}
