#include <bits/stdc++.h>
using namespace std;
char _buf[100000], *_p1 = _buf, *_p2 = _buf;
inline int gi() {
  int x = 0, f = 1;
  char ch = getchar();
  while (ch > '9' || ch < '0') {
    if (ch == '-') f = -1;
    ch = getchar();
  }
  while (ch >= '0' && ch <= '9') {
    x = (x << 3) + (x << 1) + (ch ^ 48);
    ch = getchar();
  }
  return (f == 1) ? x : -x;
}
inline long long max(long long a, long long b) { return a > b ? a : b; }
inline long long min(long long a, long long b) { return a < b ? a : b; }
const int maxn = 2e5 + 5;
int n;
long long dp[maxn][3][2][2];
int a[maxn];
inline void A(long long &a, long long b) { a = max(a, b); }
int main() {
  memset(dp, 0xcf, sizeof(dp));
  n = gi();
  for (int i = 1; i <= n; ++i) a[i] = gi();
  if (n == 1) {
    printf("%d\n", a[1]);
    return 0;
  }
  dp[1][2][0][0] = -a[1];
  dp[1][1][1][0] = a[1];
  for (int i = 1; i <= n - 1; ++i) {
    for (int j = 0; j <= 2; ++j) {
      for (int k = 0; k <= 1; ++k) {
        for (int t = 0; t <= 1; ++t) {
          if (t != k)
            A(dp[i + 1][(j + ((t == 0) ? 2 : 1)) % 3][t][0],
              dp[i][j][k][0] + ((t == 1) ? a[i + 1] : -a[i + 1]));
          if (t == k)
            A(dp[i + 1][(j + ((t == 0) ? 2 : 1)) % 3][t][1],
              dp[i][j][k][0] + ((t == 1) ? a[i + 1] : -a[i + 1]));
          A(dp[i + 1][(j + ((t == 0) ? 2 : 1)) % 3][t][1],
            dp[i][j][k][1] + ((t == 1) ? a[i + 1] : -a[i + 1]));
        }
      }
    }
  }
  printf("%lld\n", max(dp[n][1][1][1], dp[n][1][0][1]));
  return 0;
}
