#include <bits/stdc++.h>
using namespace std;
char s[10];
vector<int> p;
int main() {
  int n, cnt, ans;
  scanf("%d", &n);
  cnt = 1;
  ans = 0;
  for (int i = 1; i <= 2 * n; i++) {
    scanf("%s", s);
    if (s[0] == 'a') {
      int x;
      scanf("%d", &x);
      p.push_back(x);
    } else {
      if (p.empty())
        ;
      else if (p.back() == cnt)
        p.pop_back();
      else
        ans++, p.clear();
      cnt++;
    }
  }
  cout << ans << endl;
}
