#include <bits/stdc++.h>
#pragma comment(linker, "/STACK:64000000")
using namespace std;
const int maxlen = (int)(1e5) + 10;
const int base = (int)(1e9);
const long long mod = 1073676287;
const long long bigmod = 99194853094755497ll;
const long long infinity = (long long)1e18;
int main() {
  int n;
  scanf("%d", &n);
  vector<int> box;
  box.resize(n, 0);
  stack<int> s;
  int next = 1;
  string input;
  int a;
  int answer = 0;
  for (int i = 0; i < 2 * n; i++) {
    cin >> input;
    if (input == "add") {
      scanf("%d", &a);
      box[a - 1] = 1;
      s.push(a);
    } else {
      if (s.size() > 0) {
        if (s.top() == next) {
          next++;
          box[s.top() - 1] = 0;
          s.pop();
        } else {
          box[next - 1] = 0;
          s = stack<int>();
          next++;
          answer++;
        }
      } else {
        box[next - 1] = 0;
        next++;
      }
    }
  }
  printf("%d", answer);
  return 0;
}
