#include <bits/stdc++.h>
using namespace std;
int32_t main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long n, now = 1, res = 0;
  cin >> n;
  n *= 2;
  stack<long long> stk;
  while (n--) {
    string s;
    long long a;
    cin >> s;
    if (s == "add") {
      cin >> a;
      stk.push(a);
    } else {
      if (!stk.empty()) {
        if (stk.top() == now)
          stk.pop();
        else {
          res++;
          while (!stk.empty()) stk.pop();
        }
      }
      now++;
    }
  }
  cout << res;
}
