#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  int n;
  cin >> n;
  stack<int> stk;
  int cur = 0, res = 0;
  int t = n + n;
  while (t--) {
    string s;
    int num;
    cin >> s;
    if (s == "add") {
      cin >> num;
      stk.push(num);
    } else {
      ++cur;
      if (!stk.empty()) {
        if (stk.top() == cur)
          stk.pop();
        else {
          ++res;
          while (!stk.empty()) stk.pop();
        }
      }
    }
  }
  cout << res << "\n";
  return 0;
}
