#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  vector<int> g(1000001, 0);
  int ans = 0;
  set<int> q;
  int ret = 0;
  for (int i = 0; i < n; ++i) {
    char c;
    int a;
    cin >> c >> a;
    if (c == '+') {
      g[a]++;
    } else {
      g[a]--;
    }
    if (g[a] == -1) {
      g[a] = 0;
      ans++;
    } else if (g[a] == 1) {
      q.insert(a);
      ans = std::max((int)q.size(), ans);
    } else if (g[a] == 0) {
      if (c == '-') {
        auto it = q.find(a);
        q.erase(it);
      } else {
        q.insert(a);
        g[a]++;
        ans = std::max((int)q.size(), ans);
      }
    }
  }
  cout << ans << endl;
  return 0;
}
