#include <bits/stdc++.h>
int a[300010];
int main() {
  int n;
  char s[10];
  int tail = 0;
  int x;
  int now = 1, ans = 0;
  scanf("%d", &n);
  for (int i = 0; i < n << 1; i++) {
    scanf("%s", s);
    if (s[0] == 'a') {
      scanf("%d", &x);
      a[++tail] = x;
    } else {
      if (tail != 0) {
        if (a[tail] == now)
          tail--;
        else {
          tail = 0;
          ans++;
        }
      }
      now++;
    }
  }
  printf("%d", ans);
  return 0;
}
