#include <bits/stdc++.h>
using namespace std;
mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());
const int MOD1 = 1e9 + 7;
const int MOD2 = 998244353;
const long long INF = 2 * 1e18;
const long double PI = 3.14159265358979323846;
long long gcd(long long a, long long b) {
  if (b == 0) return a;
  return gcd(b, a % b);
}
long long fpow(long long a, long long b, long long m) {
  if (!b) return 1;
  long long ans = fpow(a * a % m, b / 2, m);
  return (b % 2 ? ans * a % m : ans);
}
long long inv(long long a, long long m) { return fpow(a, m - 2, m); }
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  long long n, ans = 0;
  cin >> n;
  vector<pair<long long, long long> > v(n);
  for (long long i = 0; i < n; i++) {
    cin >> v[i].first;
    ans += v[i].first;
    v[i].second = i + 1;
  }
  sort(v.begin(), v.end());
  set<long long> s1, s2;
  for (long long i = 1; i <= n / 2; i++) s1.insert(i * 2);
  for (long long i = 1; i <= (n + 1) / 2; i++) s2.insert(i * 2 - 1);
  sort(v.begin(), v.end());
  long long cur = 0, mx = -INF;
  if (n % 3 == 1) mx = ans;
  for (long long i = 0; i < n; i++) {
    if (s1.count(v[i].second)) s1.erase(v[i].second);
    if (s2.count(v[i].second)) s2.erase(v[i].second);
    cur += v[i].first;
    if ((i + n + 1) % 3 == 1) {
      if ((s1.empty() && s2.size() == (n + 1) / 2) ||
          (s2.empty() && s1.size() == n / 2)) {
        if (i == n - 1) continue;
        mx = max(mx, ans - 2 * (cur - v[i].first + v[i + 1].first));
      } else {
        mx = max(mx, ans - 2 * cur);
      }
    }
  }
  cout << mx;
}
