#include <bits/stdc++.h>
using namespace std;
const long long N = 100005;
int32_t main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  {
    long long i, j, k, n, m, ans = -1e18, cnt = 0, sum = 0;
    cin >> n;
    long long a[n];
    vector<long long> even, odd;
    for (i = 0; i < n; i++) {
      cin >> a[i];
      (a[i] & 1) ? odd.push_back(a[i]) : even.push_back(a[i]);
    }
    sort(even.rbegin(), even.rend());
    sort(odd.rbegin(), odd.rend());
    i = 0;
    while (i < even.size() and even[i] > 0) {
      sum += even[i];
      i++;
    }
    for (i = 0; i < odd.size(); i += 2) {
      sum += odd[i];
      ans = max(ans, sum);
      if (i + 1 < odd.size()) sum += odd[i + 1];
    }
    cout << ans << "\n";
  }
  return 0;
}
