#include <bits/stdc++.h>
using namespace std;
int main() {
  vector<int> arr;
  long int k, n, i, j, x, count = 0, flag = 0, temp, p1 = 1, p2 = 0;
  string s;
  cin >> n;
  for (i = 1; i <= (2 * n); i++) {
    cin >> s;
    if (s == "add") {
      cin >> x;
      flag = 0;
      arr.push_back(x);
      p2++;
    } else if (s == "remove") {
      if (flag == 1 || p2 == 0) {
      } else if (arr[p2 - 1] == p1) {
        arr.pop_back();
        p2--;
      } else if (arr[p2 - 1] != p1 && flag == 0) {
        count++;
        arr.clear();
        p2 = 0;
        flag = 1;
      }
      p1++;
    }
  }
  cout << count << endl;
  return 0;
}
