#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m = 0, k = 1;
  cin >> n;
  vector<int> s1;
  set<int> s2;
  for (int i = 0; i < 2 * n; ++i) {
    string s;
    cin >> s;
    if (s == "add") {
      int j;
      cin >> j;
      s1.push_back(j);
      s2.insert(j);
    } else {
      if (!s1.empty() && s1.back() != k) {
        ++m;
        s1.clear();
      } else if (!s1.empty() && s1.back() == k)
        s1.pop_back();
      s2.erase(k);
      ++k;
    }
  }
  printf("%d\n", m);
  return 0;
}
