#include <bits/stdc++.h>
using namespace std;
int iRead() {
  int x;
  cin >> x;
  return x;
}
long long lRead() {
  long long x;
  cin >> x;
  return x;
}
template <typename T>
void print(vector<T>& someVector) {
  cout << "print\n";
  for (T element : someVector) cout << element << " ";
  cout << "\n";
}
template <typename T>
void print(vector<vector<T> >& someVector) {
  cout << "print\n";
  for (vector<T> currentVector : someVector) {
    cout << "\n";
    for (T element : currentVector) {
      cout << element << " ";
    }
  }
  cout << "\n";
}
void read() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
}
int main() {
  read();
  int n = iRead();
  vector<pair<bool, int> > boolId(n);
  vector<bool> registers(1000001);
  int counter = 0;
  for (int i = 0; i < n; ++i) {
    char c;
    cin >> c;
    if (c == '+')
      boolId[i].first = true;
    else
      boolId[i].first = false;
    cin >> boolId[i].second;
    if (c == '+')
      registers[boolId[i].second] = true;
    else if (!registers[boolId[i].second])
      ++counter;
  }
  set<int> people;
  int minSize = counter;
  for (int i = 0; i < n; ++i) {
    bool operation = boolId[i].first;
    int man = boolId[i].second;
    if (operation)
      people.insert(man);
    else {
      if (people.find(man) == people.end()) --counter;
      people.erase(man);
    }
    minSize = max(minSize, (int)people.size() + counter);
  }
  cout << minSize;
  return 0;
}
