#include <bits/stdc++.h>
using namespace std;
const long long mod = 1000000007;
const int INF = 213456789;
const double eps = 1e-7;
template <class T>
T gcd(T a, T b) {
  if (!b) return a;
  return gcd(b, a % b);
}
stack<int> q;
int main() {
  int n;
  scanf("%d", &n);
  int ans = 0, now = 1, cnt = 0;
  for (int i = 0; i < 2 * n; i++) {
    char s[10];
    scanf("%s", s);
    if (s[0] == 'a') {
      int x;
      scanf("%d", &x);
      q.push(x);
      cnt++;
    }
    if (s[0] == 'r') {
      int tmp = q.top();
      if (tmp == now) cnt--;
      if (cnt > 0 && tmp != now) {
        ans++;
        cnt = 0;
      }
      q.pop();
      now++;
    }
  }
  printf("%d\n", ans);
  return 0;
}
