#include <bits/stdc++.h>
using namespace std;
stack<int> st;
int main() {
  string com;
  int n, res = 0, del = 1;
  cin >> n;
  n <<= 1;
  for (int i = 0, num; i < n; ++i) {
    cin >> com;
    if (com == "add") {
      cin >> num;
      st.push(num);
    } else {
      if (!st.empty()) {
        if (st.top() == del) {
          st.pop();
        } else {
          res++;
          stack<int> emp;
          swap(st, emp);
        }
      }
      ++del;
    }
  }
  cout << res << endl;
  return 0;
}
