#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long n, i, j, k, l, m, b, t, sum, sum1, flag, max1, min1, tmp;
  cin >> n;
  long long a[n + 1];
  sum = 0;
  min1 = INT_MAX;
  long long mn = INT_MIN;
  sum1 = 0;
  vector<long long> v;
  for (i = 1; i <= n; i++) {
    cin >> a[i];
    if (a[i] > 0) {
      sum += a[i];
      v.push_back(a[i]);
    }
    if (a[i] > 0 and a[i] % 2 == 1) {
      min1 = min(min1, a[i]);
    }
    if (a[i] < 0 and a[i] % 2 == -1) {
      mn = max(mn, a[i]);
    }
  }
  sort(v.begin(), v.end());
  if (sum % 2 == 1) {
    cout << sum << endl;
  } else {
    if (min1 != INT_MAX and mn != INT_MIN) {
      j = sum - min1;
      k = sum + mn;
      cout << max(j, k) << endl;
    } else {
      if (min1 == INT_MAX) {
        cout << sum + mn << endl;
      } else {
        cout << sum - min1 << endl;
      }
    }
  }
}
