#include <bits/stdc++.h>
using namespace std;
const int MAX = 6e5 + 5;
int done[MAX];
vector<int> help;
int main() {
  int n;
  scanf("%d", &n);
  string s;
  int cur = 1;
  int ans = 0;
  for (int i = 1; i <= 2 * n; i++) {
    cin >> s;
    if (s[0] == 'a') {
      int a;
      scanf("%d", &a);
      help.push_back(a);
    } else {
      if (!help.empty() && help[help.size() - 1] == cur) {
        help.pop_back();
        cur++;
      } else if (done[cur] && help.empty()) {
        cur++;
      } else {
        ans++;
        for (int j = 0; j < help.size(); j++) {
          done[help[j]] = 1;
        }
        help.clear();
        cur++;
      }
    }
  }
  printf("%d\n", ans);
  return 0;
}
