#include <bits/stdc++.h>
using namespace std;
template <typename T1, typename T2>
bool mini(T1 &a, T2 b) {
  if (a > b) {
    a = b;
    return true;
  }
  return false;
}
template <typename T1, typename T2>
bool maxi(T1 &a, T2 b) {
  if (a < b) {
    a = b;
    return true;
  }
  return false;
}
const int N = 2e5 + 5;
const long long oo = 1e18;
long long dp[N][2][2][2];
int a[N][2];
int n;
bool vis[N][2][2][2];
long long solve(int i, int st, int cur, int ok) {
  long long &res = dp[i][st][cur][ok];
  if (i > n) return (ok && st == cur && st == 0) ? 0 : -oo;
  if (vis[i][st][cur][ok]) return res;
  vis[i][st][cur][ok] = true;
  res = -oo;
  maxi(res, solve(i + 1, st ^ 1, st ^ 1, true) + a[i][cur]);
  maxi(res, solve(i + 1, st, cur ^ 1, ok) + a[i][cur ^ 1]);
  return res;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cin >> n;
  for (int i = 1; i <= n; i++) {
    cin >> a[i][0];
    a[i][1] = -a[i][0];
  }
  if (n == 1) return cout << a[1][0], 0;
  cout << max(solve(2, 0, 0, 0) + a[1][0], solve(2, 1, 1, 0) + a[1][1]);
  return 0;
}
