#include <bits/stdc++.h>
using namespace std;
vector<int> st;
int main() {
  int i, j, t1, t2, t3, t4, curr, n, siz, ans = 0;
  scanf("%d", &n);
  string s1 = "add", temp;
  curr = 0;
  for (i = 0; i < 2 * n; i++) {
    cin >> temp;
    if (temp == s1) {
      cin >> t1;
      st.push_back(t1);
    } else {
      curr++;
      siz = (int)st.size();
      if (siz == 0) {
        continue;
      }
      if (st[siz - 1] == curr) {
        st.pop_back();
      } else {
        ans++;
        st.clear();
      }
    }
  }
  printf("%d\n", ans);
  return 0;
}
