#include <bits/stdc++.h>
using namespace std;
#pragma comment(linker, "/stack:200000000")
int ans, t, n, m, i, j, k, a, b, c, d, e, f, g;
string s, s2, s3, s4;
int ar[(int)(1e6 + 10)];
deque<int> v;
void brainfuck();
int main() {
  ios_base::sync_with_stdio(NULL);
  cin.tie(NULL);
  cout.tie(NULL);
  brainfuck();
  return 0;
}
void brainfuck() {
  cin >> n;
  for (i = 1; i <= n; i++) {
    cin >> ar[i];
    if (ar[i] > 0) {
      v.push_back(ar[i]);
      ans += v.back();
    }
  }
  sort(v.begin(), v.end());
  if (ans & 1)
    cout << ans;
  else {
    m = v.size();
    a = (long long int)(1e9 + 10);
    for (i = 0; i < m; i++) {
      if (v[i] & 1) a = min(a, v[i]);
    }
    b = -(long long int)(1e9 + 10);
    for (i = 1; i <= n; i++) {
      if (ar[i] < 0 && ar[i] & 1) {
        b = max(b, ar[i]);
      }
    }
    cout << max(ans - a, ans + b);
  }
}
