#include <bits/stdc++.h>
using namespace std;
const long long N = 1e5 + 5;
const long long inf = 1e15;
bool vis[N][2];
long long dp[N][2], a[N];
long long n;
long long maxOddSum(long long pos, long long p) {
  if (pos == n and p == 0) return 0;
  if (pos == n) return -inf;
  if (vis[pos][p]) return dp[pos][p];
  vis[pos][p] = true;
  return dp[pos][p] = max(a[pos] + maxOddSum(pos + 1, p ^ (a[pos] & 1)),
                          maxOddSum(pos + 1, p));
}
int32_t main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  cin >> n;
  for (long long i = 0; i < n; i++) cin >> a[i];
  cout << maxOddSum(0, 1);
  return 0;
}
