#include <bits/stdc++.h>
using namespace std;
int n;
int main() {
  cin >> n;
  int odd = -2000000000, even = -2000000000, val;
  while (n--) {
    cin >> val;
    if (val % 2 == 0) {
      if (even == 2000000000)
        even = val;
      else
        even = max(even, max(even + val, val));
      if (odd != 2000000000) {
        odd = max(odd, odd + val);
      }
    } else {
      if (odd == 2000000000)
        odd = max(val, even + val);
      else {
        int c = odd;
        odd = max(odd, val);
        if (even != 2000000000) odd = max(odd, even + val);
        even = max(even, c + val);
      }
    }
  }
  if (odd != 2000000000)
    cout << odd;
  else
    cout << 0;
}
