#include <bits/stdc++.h>
using namespace std;
map<int, bool> one;
map<int, bool> two;
int ans, cnt;
int main() {
  int n;
  cin >> n;
  char c, ok;
  int x, d = 0;
  for (int i = 0; i < n; i++) {
    cin >> c >> x;
    if (c == '+') {
      if (ok = '-') {
        ans = max(ans, cnt);
        cnt -= d;
      }
      cnt++;
      one[x] = 1;
      d = 0;
    } else {
      d++;
      if (c == '-' && one[x] == 0) ans++, cnt++;
      one[x] = 0;
    }
    ans = max(ans, cnt);
    ok = c;
  }
  cout << ans;
}
