#include <bits/stdc++.h>
using namespace std;
int n, posrem3;
int poscnt, negcnt;
vector<int> poscases;
long long a[200009], ansbase;
int possi, negsi;
vector<pair<long long, int> > pos, neg;
vector<long long> ansoffset;
bool poscmp(const pair<long long, int>& a, const pair<long long, int>& b) {
  return a.first < b.first;
}
bool negcmp(const pair<long long, int>& a, const pair<long long, int>& b) {
  return a.first >= b.first;
}
bool posok(int x) { return (x % 3) == posrem3 && x >= 0 && (n - x) >= 0; }
bool checkfail(vector<int> v) {
  map<int, bool> m;
  if (v.size() > 0) {
    for (int i = 0; i < v.size(); i++) {
      m[v[i]] = 1;
    }
  }
  bool first = a[0] >= 0;
  if (m[0]) first = !first;
  bool lastsign = first;
  for (int i = 1; i < n; i++) {
    bool sign = a[i] >= 0;
    if (m[i]) sign = !sign;
    if (lastsign == sign) return false;
    lastsign = sign;
  }
  return true;
}
void mov(int no, bool needcheck) {
  long long ans2 = 0;
  vector<int> oppos;
  if (no > 0) {
    for (int i = 0; i < no; i++) {
      ans2 -= pos[i].first;
      oppos.push_back(pos[i].second);
    }
    if (!needcheck)
      ansoffset.push_back(ans2);
    else {
      if (!checkfail(oppos)) {
        ansoffset.push_back(ans2);
      } else {
        if (no + 1 <= possi) {
          ans2 = 0;
          for (int i = 0; i < no - 1; i++) ans2 -= pos[i].first;
          ans2 -= pos[no].first;
          ansoffset.push_back(ans2);
        }
      }
    }
  }
  if (no == 0) {
    if (!needcheck)
      ansoffset.push_back(0);
    else {
      if (!checkfail(oppos)) {
        ansoffset.push_back(0);
      } else {
        if (possi > 0 && negsi > 0) {
          ansoffset.push_back(-pos[0].first + neg[0].first);
        }
      }
    }
  }
  if (no < 0) {
    for (int i = 0; i < abs(no); i++) {
      ans2 += neg[i].first;
      oppos.push_back(neg[i].second);
    }
    if (!needcheck)
      ansoffset.push_back(ans2);
    else {
      if (!checkfail(oppos)) {
        ansoffset.push_back(ans2);
      } else {
        if (abs(no) + 1 <= negsi) {
          ans2 = 0;
          for (int i = 0; i < abs(no) - 1; i++) ans2 += neg[i].first;
          ans2 += neg[abs(no)].first;
          ansoffset.push_back(ans2);
        }
      }
    }
  }
}
int main() {
  scanf("%d", &n);
  if (n % 3 == 0)
    posrem3 = 2;
  else if (n % 3 == 1)
    posrem3 = 1;
  else
    posrem3 = 0;
  for (int i = 0; i < n; i++) {
    scanf("%lld", &a[i]);
    ansbase += abs(a[i]);
    if (a[i] >= 0) pos.push_back(make_pair(a[i], i));
    if (a[i] <= 0) neg.push_back(make_pair(a[i], i));
    if (a[i] >= 0)
      poscnt++;
    else
      negcnt++;
  }
  if (n == 1) {
    printf("%lld", a[0]);
    return 0;
  }
  if (n == 2) {
    printf("%lld", -a[0] - a[1]);
    return 0;
  }
  sort(pos.begin(), pos.end(), poscmp);
  sort(neg.begin(), neg.end(), negcmp);
  possi = pos.size();
  negsi = neg.size();
  for (int i = poscnt - 3; i <= poscnt + 3; i++) {
    if (posok(i)) {
      poscases.push_back(i);
    }
  }
  for (int i = 0; i < poscases.size(); i++) {
    int poscntneed = poscases[i];
    int postoneg = poscnt - poscntneed;
    bool mayalter = 0;
    if (n % 2 == 0 && n == 2 * poscntneed) mayalter = 1;
    if (n % 2 == 1 && n - 1 == 2 * poscntneed || n + 1 == 2 * poscntneed)
      mayalter = 1;
    mov(postoneg, mayalter);
  }
  sort(ansoffset.begin(), ansoffset.end());
  long long offsetbest = ansoffset[ansoffset.size() - 1];
  printf("%lld", ansbase + 2 * offsetbest);
}
