#include <bits/stdc++.h>
using namespace std;
const int MAXN = 2e5 + 5;
int dat[MAXN];
long long f[MAXN][3][2];
inline int read() {
  int x = 0;
  int f = 1;
  char ch = getchar();
  while (!isdigit(ch)) {
    ch == '-' && (f = -1);
    ch = getchar();
  }
  while (isdigit(ch)) {
    x = x * 10 + ch - '0';
    ch = getchar();
  }
  return x * f;
}
template <typename T1, typename T2>
inline void Max(T1 &x, T2 y) {
  if (x < y) x = y;
}
template <typename T1, typename T2>
inline void Min(T1 &x, T2 y) {
  if (x > y) x = y;
}
int main() {
  int n = read();
  for (int i = 1; i <= n; i++) dat[i] = read();
  if (n == 1) {
    printf("%d\n", dat[1]);
    return 0;
  }
  memset(f, 0xef, sizeof(f));
  f[0][0][1] = 0;
  for (int i = 0; i < n; i++)
    for (int j = 0; j <= 2; j++) {
      Max(f[i + 1][(j + 2) % 3][0], f[i][j][0] - dat[i + 1]);
      Max(f[i + 1][(j + 1) % 3][0], f[i][j][0] + dat[i + 1]);
      Max(f[i + 1][(j + 2) % 3][(i & 1)], f[i][j][1] - dat[i + 1]);
      Max(f[i + 1][(j + 1) % 3][!(i & 1)], f[i][j][1] + dat[i + 1]);
    }
  printf("%lld\n", f[n][1][0]);
  return 0;
}
