#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int n, i, c = 0, s = 0, x, s1 = 0;
  cin >> n;
  vector<long long int> odd, even;
  odd.push_back(0), even.push_back(0);
  for (i = 0; i < n; i++) {
    cin >> x;
    if (x >= 0) {
      if (x % 2 == 0)
        s1 += x;
      else
        even.push_back(x);
    } else
      odd.push_back(x);
  }
  sort(even.begin(), even.end());
  s += s1;
  for (i = even.size() - 1; i >= 0; i--) {
    s += even[i];
    if (s % 2 == 1) c = max(s, c);
  }
  sort(odd.begin(), odd.end());
  for (i = odd.size() - 1; i >= 0; i--) {
    if (odd[i] % 2 == -1) {
      if (c == 0)
        c = s + odd[i];
      else
        c = max(c, s + odd[i]);
      break;
    }
  }
  cout << c << endl;
  return 0;
}
