#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n;
  cin >> n;
  set<long long> s;
  vector<long long> st(1000000, 1);
  n = 2 * n;
  long long k = 0;
  long long res = 0;
  long long flag = 0;
  long long ans = 0;
  while (n--) {
    string c;
    long long x;
    cin >> c;
    if (c == "add") {
      cin >> x;
      st[k] = x;
      k++;
    }
    if (c == "remove") {
      res++;
      if (k == 0) {
        continue;
      } else if (res == st[k - 1]) {
        k--;
      } else {
        ans++;
        k = 0;
      }
    }
  }
  cout << ans << endl;
  return 0;
}
