#include <bits/stdc++.h>
using namespace std;
const int maxn = 2e5 + 10;
const int INF = 0x3f3f3f3f;
int arr[maxn];
int n;
long long dp[maxn][3][2];
int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  cout.tie(nullptr);
  cin >> n;
  for (int i = 1; i <= n; i++) cin >> arr[i];
  if (n == 1) {
    cout << arr[1] << "\n";
    return 0;
  }
  memset(dp, 0x3f, sizeof(dp));
  for (int i = 0; i < maxn; i++)
    for (int j = 0; j < 3; j++)
      for (int k = 0; k < 2; k++) dp[i][j][k] = -dp[i][j][k];
  dp[1][0][1] = arr[1];
  dp[1][1][0] = -arr[1];
  for (int i = 2; i <= n; i++) {
    int op = (i % 2 == 0) ? -1 : 1;
    for (int j = 0; j <= 2; j++) {
      if (op == 1) {
        dp[i][j][1] = max(dp[i][j][1], dp[i - 1][j][1] + arr[i]);
        dp[i][j][0] = max(dp[i][j][0], dp[i - 1][(j - 1 + 3) % 3][1] - arr[i]);
      } else {
        dp[i][j][1] = max(dp[i][j][1], dp[i - 1][(j - 1 + 3) % 3][1] - arr[i]);
        dp[i][j][0] = max(dp[i][j][0], dp[i - 1][j][1] + arr[i]);
      }
      dp[i][j][0] = max(dp[i][j][0], dp[i - 1][j][0] + arr[i]);
      dp[i][j][0] = max(dp[i][j][0], dp[i - 1][(j - 1 + 3) % 3][0] - arr[i]);
    }
  }
  cout << dp[n][((1 - (n % 3)) + 3) % 3][0] << "\n";
  return 0;
}
