#include <bits/stdc++.h>
using namespace std;
long long int gcd(long long int a, long long int b) {
  return (!b) ? a : gcd(b, a % b);
}
vector<int> vt;
int cur = 1, ans, sorted;
void solve() {
  int n;
  cin >> n;
  for (int i = 1; i <= 2 * n; i++) {
    string s;
    cin >> s;
    if (s[0] == 'a') {
      int x;
      cin >> x;
      vt.push_back(x);
    }
    if (s[0] == 'r') {
      if (!vt.empty()) {
        if (vt.back() != cur) {
          ans += 1;
          vt.clear();
        } else {
          vt.pop_back();
        }
      }
      cur++;
    }
  }
  cout << ans;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  if (fopen("input.txt", "r")) {
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
  }
  int t = 1;
  while (t--) {
    solve();
  }
}
