#include <bits/stdc++.h>
using namespace std;
int n;
long long a[200013];
long long dp[200013][3][2][2];
void upd(long long &x, long long y) {
  if (x < y) x = y;
  return;
}
int main() {
  cin >> n;
  for (int i = 1; i <= n; i++) {
    scanf("%lld", &a[i]);
    for (int j = 0; j < 3; j++)
      for (int k = 0; k < 2; k++)
        for (int l = 0; l < 2; l++) dp[i][j][k][l] = -(long long)1e18;
  }
  if (n == 1) {
    printf("%lld\n", a[1]);
    return 0;
  }
  dp[1][2][0][0] = -a[1], dp[1][1][1][0] = a[1];
  for (int i = 2; i <= n; i++) {
    for (int j = 0; j < 3; j++) {
      upd(dp[i][j][0][0], dp[i - 1][(j + 1) % 3][1][0] - a[i]);
      upd(dp[i][j][0][1], dp[i - 1][(j + 1) % 3][0][0] - a[i]);
      upd(dp[i][j][1][0], dp[i - 1][(j + 2) % 3][0][0] + a[i]);
      upd(dp[i][j][1][1], dp[i - 1][(j + 2) % 3][1][0] + a[i]);
      for (int k = 0; k < 2; k++) {
        upd(dp[i][j][0][1], dp[i - 1][(j + 1) % 3][k][1] - a[i]);
        upd(dp[i][j][1][1], dp[i - 1][(j + 2) % 3][k][1] + a[i]);
      }
    }
  }
  long long ans = max(dp[n][1][0][1], dp[n][1][1][1]);
  printf("%lld\n", ans);
  return 0;
}
