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