#include <bits/stdc++.h>
using namespace std;
const int maxn = 1000000 + 100;
int a[maxn];
int c[maxn];
int main() {
  char s[15];
  int n;
  while (~scanf("%d", &n)) {
    memset(a, 0, sizeof(a));
    int d;
    int ans = 0, cur = 0;
    int sign = 0;
    for (int i = 0; i < n; i++) {
      scanf("%s%d", s, &d);
      if (s[0] == '+') {
        sign++;
        a[d] = 1;
        c[i] = sign;
      } else {
        if (a[d] == 1) {
          sign--;
          a[d] = 0;
          c[i] = sign;
        } else {
          c[i] = c[i - 1] + 1;
          for (int j = i - 1; j >= 0; j--) c[j]++;
        }
      }
    }
    for (int i = 0; i < n; i++) {
      ans = max(ans, c[i]);
    }
    cout << ans << endl;
  }
  return 0;
}
