#include <bits/stdc++.h>
using namespace std;
long long dp[200009][3][2][2];
int main() {
  ios_base::sync_with_stdio(false);
  cout.tie(0);
  cin.tie(0);
  int n;
  cin >> n;
  vector<int> A(n + 1);
  for (int i = 1; i <= n; ++i) cin >> A[i];
  if (n == 1) {
    cout << A[1];
    return 0;
  }
  for (int i = 1; i <= n; ++i)
    for (int j = 0; j < 3; ++j)
      for (int a = 0; a < 2; ++a)
        for (int b = 0; b < 2; ++b) dp[i][j][a][b] = -1e18;
  dp[1][1][0][1] = A[1];
  dp[1][1 + 1][0][0] = -A[1];
  for (int i = 1; i < n; ++i) {
    for (int j = 0; j < 3; ++j) {
      for (int a = 0; a < 2; ++a) {
        for (int b = 0; b < 2; ++b)
          if (dp[i][j][a][b] != -1e18) {
            dp[i + 1][(j + 1 + 1) % 3][a || (b == 0)][0] =
                max(dp[i + 1][(j + 1 + 1) % 3][a || (b == 0)][0],
                    dp[i][j][a][b] - A[i + 1]);
            dp[i + 1][(j + 1) % 3][a || (b == 1)][1] =
                max(dp[i + 1][(j + 1) % 3][a || (b == 1)][1],
                    dp[i][j][a][b] + A[i + 1]);
          }
      }
    }
  }
  cout << max(dp[n][1][1][0], dp[n][1][1][1]);
  return 0;
}
