#include <bits/stdc++.h>
using namespace std;
const int INF = 0x3f3f3f3f;
const long long LINF = 0x3f3f3f3f3f3f3f3f;
const int MOD = 1e9 + 7;
const int N = 1e6 + 7;
int n;
void Init() {}
int Solve() {
  int ans = 0, num = 1;
  bool f = 0;
  vector<int> sta;
  for (int t = (0); t < (2 * n); ++t) {
    char op[10];
    scanf("%s", op);
    if (op[0] == 'a') {
      int x;
      scanf("%d", &x);
      f = 0;
      sta.push_back(x);
    } else {
      if (f) {
        num++;
        continue;
      } else {
        if (!sta.empty() && sta.back() == num) {
          num++;
          sta.pop_back();
        } else if (sta.empty()) {
          num++;
        } else {
          f = 1;
          ans++;
          num++;
          sta.clear();
        }
      }
    }
  }
  return printf("%d\n", ans);
}
int main() {
  while (~scanf("%d", &n)) {
    Init();
    Solve();
  }
  return 0;
}
