#include <bits/stdc++.h>
using namespace std;
int a[100001], n, f[100001], res = 1e9, t = -1e9;
int main() {
  cin >> n;
  for (int i = 1; i <= n; i++) {
    cin >> a[i];
    if (a[i] % 2 == 1 && a[i] >= 0) {
      res = min(res, a[i]);
    }
    if (a[i] < 0 && abs(a[i]) % 2 == 1) {
      t = max(t, a[i]);
    }
  }
  for (int i = 1; i <= n; i++) {
    if (a[i] > 0) {
      f[i] = f[i - 1] + a[i];
    } else {
      f[i] = f[i - 1];
    }
  }
  if (f[n] % 2 == 0) {
    f[n] = max(f[n] - res, f[n] + t);
    cout << f[n];
  } else {
    cout << f[n];
  }
}
