#include <bits/stdc++.h>
using namespace std;
int n, a[131072];
vector<int> odd, even;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(NULL);
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
    if (a[i] % 2 == 0)
      even.push_back(a[i]);
    else
      odd.push_back(a[i]);
  }
  sort(even.begin(), even.end());
  sort(odd.begin(), odd.end());
  int ans = 0;
  ans = odd[odd.size() - 1];
  int i = odd.size() - 2, j = odd.size() - 3;
  if (j >= 0) {
    while (j >= 0) {
      if (odd[i] + odd[j] > 0) {
        ans += odd[i] + odd[j];
        i -= 2;
        j -= 2;
      } else
        break;
    }
  }
  i = even.size() - 1;
  if (i >= 0) {
    while (i >= 0) {
      if (even[i] > 0) {
        ans += even[i];
        i--;
      } else
        break;
    }
  }
  cout << ans << endl;
  return 0;
}
