#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m, a = 1, c = 0, s = 0;
  cin >> n;
  vector<int> v;
  string str;
  for (int i = 0; i < n * 2; i++) {
    cin >> str;
    if (str == "add") {
      cin >> m;
      v.push_back(m);
    } else if (str == "remove") {
      if (v.back() == a && !v.empty()) {
        v.pop_back();
      } else if (!v.empty()) {
        v.clear();
        c++;
      }
      a++;
    }
  }
  cout << c;
  return 0;
}
