#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  int a[100009];
  int b[100009];
  int q = 0, w = 0;
  long long ans = 0;
  for (int i = 0; i < n; i++) {
    int k;
    cin >> k;
    if (k > 0) {
      if (k % 2) {
        a[q++] = k;
      } else
        ans += k;
    } else
      b[w++] = k;
  }
  if (q % 2 == 1) {
    for (int i = 0; i < q; i++) ans += a[i];
    cout << ans << endl;
    return 0;
  }
  sort(a, a + q);
  sort(b, b + w);
  if (q == 0) {
    for (int i = w - 1; i >= 0; i--) {
      if (-b[i] % 2 == 1) {
        cout << ans + b[i];
        return 0;
      }
    }
    cout << "-1";
    return 0;
  }
  for (int i = 1; i < q; i++) {
    ans += a[i];
  }
  for (int i = w - 1; i >= 0; i--) {
    if (-b[i] % 2 == 1) {
      if (a[0] > -b[i])
        cout << ans + a[0] + b[i];
      else
        cout << ans;
      return 0;
    }
  }
  cout << ans;
  return 0;
}
