#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  long long n;
  cin >> n;
  stack<long long> se;
  long long k = 2 * n, ans = 0, cnt = 0;
  while (k--) {
    string second;
    cin >> second;
    if (second == "add") {
      long long k;
      cin >> k;
      se.push(k);
    } else {
      cnt++;
      if (se.empty()) continue;
      if (se.top() == cnt)
        se.pop();
      else {
        ans++;
        while (!se.empty()) se.pop();
      }
    }
  }
  cout << ans;
  return 0;
}
