#include <bits/stdc++.h>
using namespace std;
char str[10];
vector<int> p;
int n, x, cnt, ans, d;
int main() {
  cin >> n;
  cnt = 1;
  ans = 0;
  for (int i = 1; i <= 2 * n; i++) {
    cin >> str;
    if (str[0] == 'a') {
      cin >> 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;
}
