#include <bits/stdc++.h>
using namespace std;
int main() {
  vector<long> v;
  priority_queue<long, vector<long>, greater<long> > pq;
  string str;
  long n, expected = 1, ans = 0, el = -1;
  cin >> n;
  cin >> ws;
  n *= 2;
  while (n--) {
    cin >> str;
    if (str == "add") {
      cin >> el;
      v.push_back(el);
      pq.push(el);
    } else {
      if (v.size() != 0) {
        if (v[v.size() - 1] == expected) {
          v.erase(--v.end());
          pq.pop();
        } else {
          v.clear();
          ans++;
          pq.pop();
        }
      } else {
        pq.pop();
      }
      expected++;
    }
  }
  cout << ans << endl;
}
