#include <bits/stdc++.h>
using namespace std;
char s[10];
int main() {
  int n;
  while (~scanf("%d", &n)) {
    stack<int> A;
    int now = 1;
    int ans = 0;
    for (int i = 1; i <= 2 * n; i++) {
      scanf("%s", s);
      if (s[0] == 'a') {
        int x;
        scanf("%d", &x);
        A.push(x);
      } else {
        if (!A.empty()) {
          if (A.top() == now)
            A.pop();
          else {
            ans++;
            while (!A.empty()) A.pop();
          }
        }
        now++;
      }
    }
    cout << ans << endl;
  }
  return 0;
}
