#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  int n, x, toRemove = 1;
  cin >> n;
  string command;
  stack<int> boxes;
  set<int> sorted;
  int reorders = 0;
  for (int i = 0; i < 2 * n; i++) {
    cin >> command;
    if (command == "add") {
      cin >> x;
      boxes.push(x);
    } else {
      if (boxes.empty())
        sorted.erase(sorted.begin());
      else if (boxes.top() != toRemove) {
        reorders++;
        while (!boxes.empty()) {
          sorted.insert(boxes.top());
          boxes.pop();
        }
        sorted.erase(sorted.begin());
      } else
        boxes.pop();
      toRemove++;
    }
  }
  cout << reorders;
  return 0;
}
