#include <bits/stdc++.h>
using namespace std;
long long a[100010], b[100010];
int main() {
  long long n, i, s = 0, k = 0;
  cin >> n;
  for (i = 1; i <= n; i++) {
    cin >> a[i];
    if (a[i] >= 0 && a[i] % 2 == 0) s += a[i];
    if ((a[i] + 100000) % 2 == 1) k++, b[k] = a[i];
  }
  sort(b + 1, b + 1 + k);
  s += b[k];
  for (i = k - 1; i >= 1; i -= 2) {
    if (i > 1 && b[i] + b[i - 1] > 0) s += (b[i] + b[i - 1]);
  }
  cout << s;
}
