#include <bits/stdc++.h>
using namespace std;
const long long N = 200005;
long long n, a[N], sum[N], dp[N][3];
signed main() {
  scanf("%lld", &n);
  for (long long i = 1; i <= n; i++) scanf("%lld", &a[i]);
  if (n == 1) {
    printf("%lld\n", a[1]);
    return 0;
  }
  for (long long i = 1; i <= n; i++)
    if (i & 1)
      sum[i] = sum[i - 1] + a[i];
    else
      sum[i] = sum[i - 1] - a[i];
  for (long long i = 0; i < N; i++)
    for (long long j = 0; j < 3; j++) dp[i][j] = -1e18;
  dp[1][1] = -a[1];
  for (long long i = 2; i <= n; i++) {
    if (i & 1)
      dp[i][(i / 2 + 1) % 3] = sum[i - 1] - a[i];
    else
      dp[i][(i - 1) / 2 % 3] = sum[i - 1] + a[i];
    for (long long j = 0; j < 3; j++)
      dp[i][j] = max(dp[i][j],
                     max(dp[i - 1][(j + 2) % 3] - a[i], dp[i - 1][j] + a[i]));
  }
  printf("%lld\n", dp[n][(N - n) % 3]);
}
