#include <bits/stdc++.h>
int main() {
  int n, k, temp, a[300010], top = 0, c = 1, ans = 0, flag = 0;
  char str[10];
  scanf("%d", &n);
  k = 2 * n;
  while (k--) {
    scanf("%s", str);
    if (str[0] == 'a') {
      scanf("%d", &temp);
      a[top] = temp;
      top++;
    } else {
      if (top != 0) {
        if (a[top - 1] == c) {
          top--;
          c++;
        } else {
          ans++;
          top = 0;
          c++;
        }
      } else
        c++;
    }
  }
  printf("%d\n", ans);
  return 0;
}
