#include <bits/stdc++.h>
using namespace std;
long long inf = 1000000007;
int stac[400000];
int main() {
  int wanted = 1;
  int n;
  cin >> n;
  char s[10];
  int aux;
  int k = 0;
  int size = 0;
  for (int i = 0; i < 2 * n; ++i) {
    scanf("%s", s);
    if (s[0] == 'a') {
      scanf("%d", &aux);
      stac[size++] = aux;
    } else {
      if (size > 0) {
        if (stac[size - 1] == wanted)
          size--;
        else {
          k++;
          size = 0;
        }
      }
      wanted++;
    }
  }
  printf("%d\n", k);
}
