#include <bits/stdc++.h>
using namespace std;
int main() {
  long long ans = 0;
  long long n;
  scanf("%lli", &n);
  long long marker = 1;
  long long flag = false;
  string cmd;
  stack<long long> zero;
  stack<long long> stk;
  for (long long i = 1; i <= 2 * n; i++) {
    cin >> cmd;
    if (cmd == "add") {
      long long num = 0;
      scanf("%lli", &num);
      stk.push(num);
    } else {
      if (stk.size()) {
        if (stk.top() == marker) {
          stk.pop();
        } else {
          ans++;
          stk = zero;
        }
      }
      marker++;
    }
  }
  cout << ans << endl;
  return 0;
}
