#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(false);
  int n, poz = -1, q[300000], cnt = 1, ans = 0;
  cin >> n;
  for (int i = 0; i < n + n; i++) {
    string c;
    cin >> c;
    if (c == "add")
      cin >> q[++poz];
    else {
      if (poz == -1)
        ;
      else if (q[poz] == cnt)
        poz--;
      else
        ans++, poz = -1;
      cnt++;
    }
  }
  cout << ans;
  return 0;
}
