#include <bits/stdc++.h>
using namespace std;
template <class T>
ostream& operator<<(ostream& os, vector<T> V) {
  os << "[ ";
  for (auto v : V) os << v << " ";
  return os << "]";
}
template <class T>
ostream& operator<<(ostream& os, set<T> S) {
  os << "{ ";
  for (auto s : S) os << s << " ";
  return os << "}";
}
template <class L, class R>
ostream& operator<<(ostream& os, pair<L, R> P) {
  return os << "(" << P.first << "," << P.second << ")";
}
template <class L, class R>
ostream& operator<<(ostream& os, map<L, R> M) {
  os << "{ ";
  for (auto m : M) os << "(" << m.first << ":" << m.second << ") ";
  return os << "}";
}
const int MAX = 1000010;
const int MOD2 = 998244353;
const int MOD = 1000000007;
const int INF = 1e8;
const long long int LLINF = 0x3f3f3f3f3f3f3f3f;
const long double EPS = 1e-7;
void solve() {
  int n;
  cin >> n;
  vector<int> a(n);
  bool pos = false, neg = false;
  long long int sum = 0;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
    sum += abs(a[i]);
    if (a[i] < 0)
      neg = true;
    else if (a[i] > 0)
      pos = true;
  }
  if (n == 1) {
    cout << a[0] << "\n";
    return;
  }
  if (neg and pos) {
    cout << sum << "\n";
  } else if (neg) {
    sort(a.begin(), a.end(), greater<int>());
    cout << sum + 2 * a[0] << "\n";
  } else if (pos) {
    sort(a.begin(), a.end());
    cout << sum - 2 * a[0] << "\n";
  } else {
    cout << 0 << "\n";
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  cout << fixed << setprecision(25);
  cerr << fixed << setprecision(10);
  auto start = std::chrono::high_resolution_clock::now();
  solve();
  auto stop = std::chrono::high_resolution_clock::now();
  auto duration =
      std::chrono::duration_cast<std::chrono::nanoseconds>(stop - start);
  return 0;
}
