#include <bits/stdc++.h>
using namespace std;
bool valid(const vector<bool> &sign) {
  int n = sign.size();
  for (int i = 2; i < n; i++)
    if (sign[i] != sign[i - 2]) return true;
  return false;
}
void test_case() {
  int n;
  cin >> n;
  long long sum = 0, ans = -1e18;
  vector<pair<long long, int>> a(n);
  for (int i = 0; i < n; i++) {
    long long tmp;
    cin >> tmp;
    a[i] = make_pair(tmp, i);
    sum += tmp;
  }
  sort(a.begin(), a.end());
  if (n % 3 == 1) ans = sum;
  int minus = 0;
  vector<bool> sign(n, true);
  for (int i = 0; i < n; i++) {
    ++minus;
    sign[a[i].second] = false;
    sum -= 2 * a[i].first;
    if ((n + minus) % 3 != 1) continue;
    if ((minus == n / 2 || minus == n - n / 2) && !valid(sign))
      ans = max(ans, sum + 2 * a[i].first - 2 * a[i + 1].first);
    else
      ans = max(ans, sum);
  }
  cout << ans << '\n';
}
int main(void) {
  ios::sync_with_stdio(0);
  cin.tie(0);
  int Case = 1;
  for (int i = 1; i <= Case; i++) {
    test_case();
  }
  return 0;
}
