#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  cout.precision(10);
  cout << fixed;
  long long n, x;
  cin >> n;
  vector<pair<long long, long long>> v(n);
  for (long long i = 0; i < n; i++) {
    cin >> x;
    v[i] = {x, i};
  }
  sort(v.begin(), v.end());
  if (n == 1) {
    cout << v[0].first << "\n";
    return 0;
  }
  long long cambios = 0;
  if (n % 3 == 1) {
    cambios = 0;
  } else if (n % 3 == 2) {
    cambios = 2;
  } else {
    cambios = 1;
  }
  long long sum = 0;
  for (long long i = 0; i < n; i++) sum += v[i].first;
  bool impar = true;
  long long ans = -1e18;
  long long ini = 0;
  while (ini < n) {
    if (ini + cambios > n) break;
    while (cambios > 0) {
      if (v[ini].second % 2 == 0) impar = false;
      sum -= 2 * v[ini].first;
      ini++;
      cambios--;
    }
    if (n % 2 == 1 && n / 2 == ini && impar) {
      long long auxi = sum;
      auxi = auxi - 2 * v[ini].first + 2 * v[ini - 1].first;
      ans = max(auxi, ans);
    } else {
      ans = max(ans, sum);
    }
    cambios += 3;
  }
  cout << ans << "\n";
  return 0;
}
