#include <bits/stdc++.h>
using namespace std;
const int mx = 1000006;
vector<int> adj[mx];
int main() {
  int n;
  cin >> n;
  int sorted = 0;
  int thrown = 0;
  int ans = 0;
  stack<int> sk;
  for (int i = 1; i <= 2 * n; i++) {
    string str;
    cin >> str;
    if (str[0] == 'a') {
      int x;
      cin >> x;
      sk.push(x);
    } else {
      thrown++;
      if (sk.size() && sk.top() == thrown) {
        sk.pop();
      } else {
        if (sk.empty())
          continue;
        else {
          while (sk.size()) {
            sk.pop();
          }
          ans++;
        }
      }
    }
  }
  cout << ans << endl;
}
