#include <bits/stdc++.h>
using namespace std;
const int maxn = 3e5 + 10;
int n, a[maxn];
char s[20];
int main() {
  scanf("%d", &n);
  int len, cur, num, ans;
  len = 0;
  ans = 0;
  cur = 0;
  for (int i = 1; i <= 2 * n; i++) {
    cin >> s;
    if (s[0] == 'a') {
      scanf("%d", &num);
      a[++len] = num;
    } else {
      if (a[len] == cur + 1) {
        len--;
      } else if (len != 0) {
        len = 0;
        ans++;
      }
      cur++;
    }
  }
  printf("%d\n", ans);
}
