#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
using namespace std;
void solve() {
  long long int n;
  cin >> n;
  vector<long long int> dp(3, -1e16);
  long long int val_alt = 0;
  long long int a;
  for (long long int i = 0; i < n; i++) {
    cin >> a;
    dp = {max(dp[2] + a, dp[1] - a), max(dp[0] + a, dp[2] - a),
          max(dp[1] + a, dp[0] - a)};
    if (i & 1) {
      a = -a;
    }
    dp[2] = max(dp[2], val_alt - a);
    val_alt += a;
  }
  cout << (n == 1 ? val_alt : dp[1]) << '\n';
}
int32_t main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  solve();
  cerr << "Time : " << 1000 * ((double)clock()) / (double)CLOCKS_PER_SEC
       << "ms\n";
  return 0;
}
