#include <bits/stdc++.h>
int cmp(const void *a, const void *b) { return *(int *)a - *(int *)b; }
int main() {
  int n, a[200000], i, sum = 0, k = 0, b[200000];
  scanf("%d", &n);
  for (i = 0; i < n; i++) {
    scanf("%d", &a[i]);
    if (a[i] % 2 == 0 && a[i] > 0) sum = sum + a[i];
    if (a[i] % 2 != 0) b[k++] = a[i];
  }
  qsort(b, k, sizeof(int), cmp);
  sum = sum + b[--k];
  while (k >= 2) {
    k = k - 2;
    if (b[k] + b[k + 1] > 0) {
      sum += b[k] + b[k + 1];
    }
  }
  printf("%d", sum);
  return 0;
}
