#include <bits/stdc++.h>
using namespace std;
const int N = 2e5 + 25;
long long dp[N][3][2][2], a[N];
int main() {
  ios::sync_with_stdio(false);
  cin.tie(NULL);
  cout << setprecision(32);
  int n;
  cin >> n;
  for (int i = 1; i <= n; i++) {
    cin >> a[i];
  }
  if (n == 1) {
    cout << a[1] << '\n';
    exit(0);
  } else if (n == 2) {
    cout << (-a[1] - a[2]) << '\n';
    exit(0);
  }
  memset(dp, 0xfe, sizeof(dp));
  dp[1][0][0][0] = a[1];
  dp[1][1][1][0] = -a[1];
  for (int i = 1; i < n; i++) {
    for (int nm = 0; nm < 3; nm++) {
      for (int en = 0; en < 2; en++) {
        for (int flg = 0; flg < 2; flg++) {
          for (int cur = 0; cur < 2; cur++) {
            int nflg = flg || (cur == en);
            int nnm = nm + (cur == 1);
            if (nnm == 3) nnm = 0;
            dp[i + 1][nnm][cur][nflg] =
                max(dp[i + 1][nnm][cur][nflg],
                    dp[i][nm][en][flg] + (1 - 2 * cur) * a[i + 1]);
          }
        }
      }
    }
  }
  int nm;
  if (n % 3 == 1) nm = 0;
  if (n % 3 == 2) nm = 2;
  if (n % 3 == 0) nm = 1;
  cout << max(dp[n][nm][0][1], dp[n][nm][1][1]) << '\n';
  return 0;
}
