#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  int a[100000];
  cin >> n;
  int m = 0;
  int even = 0;
  for (int i = 0; i < n; i++) {
    int c;
    cin >> c;
    if (c % 2 == 0 && c > 0)
      even += c;
    else if (c % 2 != 0) {
      a[m] = c;
      m++;
    }
  }
  int b[2];
  b[0] = 0;
  b[1] = a[0];
  for (int i = 1; i < m; i++) {
    int x = b[0], y = b[1];
    if (x < a[i] + y) b[0] = a[i] + y;
    if (y < a[i] + x) b[1] = a[i] + x;
  }
  cout << b[1] + even;
  return 0;
}
