#include <bits/stdc++.h>
using namespace std;
int s[300010];
int main() {
  int n, i, t = 0, ans = 0, temp, j = 1;
  string str;
  cin >> n;
  for (i = 1; i <= 2 * n; i++) {
    cin >> str;
    if (str[0] == 'a') {
      cin >> temp;
      s[++t] = temp;
    } else {
      if (t) {
        if (s[t] == j)
          t--;
        else
          t = 0, ans++;
      }
      j++;
    }
  }
  cout << ans << endl;
}
