#include <bits/stdc++.h>
using namespace std;
stack<int> st;
priority_queue<int, vector<int>, greater<int> > q;
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int n;
  cin >> n;
  n <<= 1;
  int Now = 1;
  int Answer = 0;
  while (n--) {
    string s;
    cin >> s;
    if (s == "add") {
      int x;
      cin >> x;
      st.push(x);
    } else {
      if (st.empty())
        q.pop();
      else if (st.top() == Now)
        st.pop();
      else {
        while (!st.empty()) q.push(st.top()), st.pop();
        q.pop();
        Answer++;
      }
      Now++;
    }
  }
  cout << Answer;
}
