#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  int res = 0;
  bool reodre = false;
  priority_queue<int, vector<int>, greater<int> > q;
  stack<int> stk;
  for (int i = 0; i < 2 * n; i++) {
    string s;
    int x;
    cin >> s;
    if (s == "add") {
      cin >> x;
      q.push(x);
      stk.push(x);
      if (stk.top() != q.top()) reodre = false;
    }
    if (s == "remove") {
      if (stk.top() != q.top() && !reodre) res++, reodre = true;
      q.pop();
      stk.pop();
    }
  }
  cout << res << endl;
  return 0;
}
