#include <bits/stdc++.h>
using namespace std;
long long modulo = 1000000007ll;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  int n;
  cin >> n;
  vector<int> vec(n);
  for (int i = 0; i < n; ++i) {
    cin >> vec[i];
  }
  int max = INT_MIN;
  int min = INT_MAX;
  int temp = -1, temp1 = -1;
  for (int i = 0; i < n; ++i) {
    if (vec[i] > max) {
      max = vec[i];
      temp = i;
    }
    if (vec[i] < min && i != temp) {
      min = vec[i];
      temp1 = i;
    }
  }
  for (int i = 0; i < n; ++i) {
    if (vec[i] < min && i != temp) {
      min = vec[i];
      temp1 = i;
    }
  }
  long long sum = 0;
  for (int i = 0; i < n; ++i) {
    if (i == temp) {
      sum += vec[i];
    } else if (i == temp1) {
      sum -= vec[i];
    } else
      sum += abs(vec[i]);
  }
  cout << sum << endl;
}
