#include <bits/stdc++.h>
using namespace std;
int n, x, a[300000], top, now = 1, ans;
char s[7];
vector<int> v;
int main(int argc, char const *argv[]) {
  scanf("%d", &n);
  n *= 2;
  bool sorted = false;
  for (int i = 0; i < n; ++i) {
    scanf("%s", s);
    if (!strcmp(s, "add")) {
      scanf("%d", &x);
      v.push_back(x);
    } else {
      if (!v.empty() && v.back() != now) {
        v.clear();
        ans++;
      }
      if (!v.empty()) v.pop_back();
      now++;
    }
  }
  printf("%d\n", ans);
  return 0;
}
