#include <bits/stdc++.h>
const int Inf = 2 * 1000 * 1000 * 1000;
long long LINF = (long long)4e18;
using namespace std;
const int nax = 1000 * 100 + 5;
int a[nax];
int D[nax][2];
void upd(int &a, int b) { a = max(a, b); }
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int n;
  cin >> n;
  for (int i = 0; i <= n + 1; i++) {
    for (int j = 0; j < 2; j++) {
      D[i][j] = -2e9;
    }
  }
  for (int i = 1; i <= n; i++) {
    cin >> a[i];
    D[i][abs(a[i]) % 2] = a[i];
  }
  for (int i = 1; i <= n; i++) {
    for (int j = 0; j < 2; j++) {
      upd(D[i + 1][j], D[i][j]);
      if (D[i][j] != -2e9)
        upd(D[i + 1][abs(D[i][j] + a[i + 1]) % 2], D[i][j] + a[i + 1]);
    }
  }
  cout << D[n + 1][1];
  return 0;
}
