#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e5 + 10;
int a[maxn], dp[maxn][2];
int main() {
  int n;
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) scanf("%d", &a[i]);
  memset(dp, -0x3f, sizeof(dp));
  for (int i = 1; i <= n; i++) {
    if (i != 1) {
      dp[i][0] = dp[i - 1][0];
      dp[i][1] = dp[i - 1][1];
    }
    if (a[i] & 1) {
      dp[i][1] = max(dp[i][1], a[i]);
      dp[i][0] = max(dp[i][0], dp[i - 1][1] + a[i]);
      dp[i][1] = max(dp[i][1], dp[i - 1][0] + a[i]);
    } else {
      dp[i][0] = max(dp[i][0], a[i]);
      dp[i][0] = max(dp[i][0], dp[i - 1][0] + a[i]);
      dp[i][1] = max(dp[i][1], dp[i - 1][1] + a[i]);
    }
  }
  printf("%d", dp[n][1]);
  return 0;
}
