#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  int toDelete = 1;
  int reorder = 0;
  stack<int> s;
  for (int t = 0; t < 2 * n; t++) {
    char cmd[10];
    cin >> cmd;
    if (cmd[0] == 'a') {
      int val;
      cin >> val;
      s.push(val);
    } else {
      if (!s.empty() && s.top() == toDelete)
        s.pop();
      else if (!s.empty() && s.top() != toDelete) {
        reorder++;
        while (!s.empty()) s.pop();
      }
      toDelete++;
    }
  }
  cout << reorder;
  return 0;
}
