#include <bits/stdc++.h>
using namespace std;
const long long mx = 105;
const long long maxn = -1000000001;
const long long mod = 1000000007;
int main() {
  long long t = 1;
  while (t--) {
    long long n, i, j, k;
    cin >> n;
    long long a[n];
    for (i = 0; i < n; i++) cin >> a[i];
    long long mo = maxn, me = 0;
    for (i = 0; i < n; i++) {
      if (a[i] % 2 == 0) {
        me = max(me, me + a[i]);
        if (mo != maxn) {
          mo = max(mo, mo + a[i]);
        }
      } else {
        long long te = mo, te1 = me;
        if (mo != maxn) {
          me = max(me, mo + a[i]);
        }
        mo = max(te, te1 + a[i]);
      }
    }
    cout << mo << "\n";
  }
}
