#include <bits/stdc++.h>
using namespace std;
using ll = long long;
signed main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  int n;
  while (cin >> n) {
    vector<pair<ll, int>> a(n);
    for (int i = 0; i < n; ++i) {
      cin >> a[i].first;
      a[i].second = i;
    }
    if (n == 1) {
      cout << a[0].first << "\n";
      continue;
    }
    sort(a.begin(), a.end());
    vector<ll> pref(n + 1);
    for (int i = 0; i < n; ++i) pref[1 + i] = pref[i] + a[i].first;
    ll res = -1e15;
    for (int k = 0; k <= n; ++k) {
      if ((n + k) % 3 == 1) {
        ll cur = -pref[k] + pref[n] - pref[k];
        if (2 * k + 1 == n || 2 * k - 1 == n) {
          vector<char> used(n);
          for (int i = 0; i < k; ++i) {
            used[a[i].second] = true;
          }
          bool good = false;
          for (int i = 0; i + 1 < n; ++i) {
            if (used[i] == used[i + 1]) {
              good = true;
            }
          }
          if (!good) {
            cur += 2 * (a[k - 1].first - a[k].first);
          }
        }
        res = max(res, cur);
      }
    }
    cout << res << "\n";
  }
}
