#include <bits/stdc++.h>
using namespace std;
const long long maxn = 2e5 + 5;
long long mod;
inline long long read() {
  long long x = 0, f = 1;
  char ch = getchar();
  while (ch < '0' || ch > '9') {
    if (ch == '-') f = -1;
    ch = getchar();
  }
  while (ch >= '0' && ch <= '9') {
    x = x * 10 + ch - '0';
    ch = getchar();
  }
  return x * f;
}
long long n;
long long a[maxn];
long long dp[maxn][5][2];
signed main() {
  n = read();
  for (long long i = 1; i <= n; i++) a[i] = read();
  if (n == 1) {
    printf("%lld\n", a[1]);
    return 0;
  }
  memset(dp, 128, sizeof(dp));
  dp[0][0][1] = 0;
  for (long long i = 1; i <= n; i++) {
    for (long long j = 0; j <= 2; j++) {
      dp[i][(j + 2) % 3][0] =
          max(dp[i][(j + 2) % 3][0], dp[i - 1][j][0] - a[i]);
      dp[i][(j + 1) % 3][0] =
          max(dp[i][(j + 1) % 3][0], dp[i - 1][j][0] + a[i]);
      dp[i][(j + 2) % 3][!(i & 1)] =
          max(dp[i][(j + 2) % 3][!(i & 1)], dp[i - 1][j][1] - a[i]);
      dp[i][(j + 1) % 3][i & 1] =
          max(dp[i][(j + 1) % 3][i & 1], dp[i - 1][j][1] + a[i]);
    }
  }
  printf("%lld\n", dp[n][1][0]);
  return 0;
}
