#include <bits/stdc++.h>
using namespace std;
long long f[200005][3][2][2];
int a[200005];
void update(long long &x, long long y) {
  if (y > x) x = y;
}
int main() {
  int n;
  scanf("%d", &n);
  memset(f, 0xbf, sizeof(f));
  f[0][0][0][1] = 0;
  for (int i = 1; i <= n; i++) scanf("%d", &a[i]);
  if (n == 1) {
    printf("%d", a[1]);
    return 0;
  }
  for (int i = 0; i < n; i++)
    for (int j = 0; j <= 2; j++)
      for (int k = 0; k <= 1; k++) {
        update(f[i + 1][(j + 2) % 3][0][0], f[i][j][k][0] - a[i + 1]);
        update(f[i + 1][(j + 1) % 3][1][0], f[i][j][k][0] + a[i + 1]);
        update(f[i + 1][(j + 2) % 3][0][((i & 1) && k == 1)],
               f[i][j][k][1] - a[i + 1]);
        update(f[i + 1][(j + 1) % 3][1][(!(i & 1) && k == 0)],
               f[i][j][k][1] + a[i + 1]);
      }
  printf("%lld", max(f[n][1][0][0], f[n][1][1][0]));
  return 0;
}
