#include <bits/stdc++.h>
using namespace std;
int binarySearch(int arr[], int l, int r, int x) {
  while (l <= r) {
    int m = l + (r - l) / 2;
    if (arr[m] == x) return m;
    if (arr[m] < x)
      l = m + 1;
    else
      r = m - 1;
  }
  return -1;
}
bool isprime(int n) {
  if (n <= 1) return false;
  for (int i = 2; i < n; i++)
    if (n % i == 0) return false;
  return true;
}
long long int factorial(int n) {
  if (n == 0) return 1;
  return n * factorial(n - 1);
}
int countDigit(long long n) {
  int count = 0;
  while (n != 0) {
    n = n / 10;
    ++count;
  }
  return count;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long int n;
  cin >> n;
  long long int arr[n], sum = 0, p = 0;
  vector<int> e, o, v, v2;
  for (int i = 0; i < n; i++) {
    cin >> arr[i];
    if (arr[i] % 2 == 0)
      e.push_back(arr[i]);
    else
      o.push_back(arr[i]);
  }
  for (int i = 0; i < e.size(); i++) {
    if (e[i] > 0) sum += e[i];
  }
  for (int i = 0; i < o.size(); i++) {
    if (o[i] > 0) p++;
  }
  for (int i = 0; i < o.size(); i++) {
    if (o[i] > 0)
      v.push_back(o[i]);
    else
      v2.push_back(o[i]);
  }
  sort(o.begin(), o.end());
  sort(v.begin(), v.end());
  sort(v2.begin(), v2.end());
  if (p == 0)
    sum += o[o.size() - 1];
  else {
    if (p % 2 == 1) {
      for (int i = 0; i < o.size(); i++) {
        if (o[i] > 0) sum += o[i];
      }
    } else {
      for (int i = 1; i < v.size(); i++) sum += v[i];
      if (v2.size() > 0) sum = max(sum, (sum + v[0] + v2[v2.size() - 1]));
    }
  }
  cout << sum;
  return 0;
}
