#include <bits/stdc++.h>
using namespace std;
const int N = 2e5 + 5;
const int M = 8e5 + 5;
const long long inf = 1e17;
long long read() {
  long long x = 0, t = 1;
  char ch;
  while (!isdigit(ch = getchar()))
    if (ch == '-') t = -1;
  while (isdigit(ch)) {
    x = 10 * x + ch - '0';
    ch = getchar();
  }
  return x * t;
}
long long dp[N][3][2];
long long a[N];
int main() {
  int n = read();
  for (int i = 1; i <= n; i++) a[i] = read();
  for (int i = 1; i <= n; i++)
    for (int j = 0; j < 3; j++)
      for (int k = 0; k < 2; k++) dp[i][j][k] = -inf;
  if (n == 1) return 0 * printf("%lld\n", a[1]);
  dp[1][1][0] = -a[1];
  dp[1][0][1] = a[1];
  for (int i = 2; i <= n; i++) {
    for (int j = 0; j < 3; j++) {
      if (i & 1) {
        dp[i][j][1] = dp[i - 1][j][1] + a[i];
        dp[i][j][0] = dp[i - 1][(j + 2) % 3][1] - a[i];
      } else {
        dp[i][j][1] = dp[i - 1][(j + 2) % 3][1] - a[i];
        dp[i][j][0] = dp[i - 1][j][1] + a[i];
      }
      dp[i][j][0] = max(dp[i][j][0], dp[i - 1][j][0] + a[i]);
      dp[i][j][0] = max(dp[i][j][0], dp[i - 1][(j + 2) % 3][0] - a[i]);
    }
  }
  printf("%lld\n", dp[n][((1 - n) % 3 + 3) % 3][0]);
  return 0;
}
