#include <bits/stdc++.h>
using namespace std;
void solve(istream &in, ostream &out);
int main() {
  ios::sync_with_stdio(false);
  solve(cin, cout);
  return 0;
}
int state[1000100];
bool counted[1000100];
void solve(istream &in, ostream &out) {
  int n;
  cin >> n;
  int result = 0;
  int current = 0;
  int max_addition = 0;
  for (int i = 0; i < n; ++i) {
    char ch;
    int id;
    in >> ch >> id;
    if (ch == '-') {
      --state[id];
      if (state[id] == -1 && !counted[id]) {
        counted[id] = true;
        ++result;
      }
      --current;
    } else {
      ++state[id];
      ++current;
      max_addition = max(current, max_addition);
    }
  }
  result += max_addition;
  out << result << endl;
}
