#include <bits/stdc++.h>
using namespace std;
int dr[] = {-1, 0, 1, 0, -1, 1, 1, -1};
int dc[] = {0, 1, 0, -1, 1, 1, -1, -1};
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  int n;
  while (cin >> n) {
    vector<int> arr;
    int st = 1;
    int ans = 0;
    for (int i = (0); i <= (2 * n - 1); i += (1)) {
      string s;
      cin >> s;
      if (s == "remove") {
        if (arr.empty()) {
          st++;
          continue;
        }
        if (st == arr[(int)arr.size() - 1]) {
          st++;
          arr.pop_back();
        } else {
          arr.clear();
          st++;
          ans++;
        }
      } else {
        int nn;
        cin >> nn;
        arr.push_back(nn);
      }
    }
    cout << ans << endl;
  }
  return 0;
}
