#include <bits/stdc++.h>
using namespace std;
int cond = 0, multi = 0, gcj = 0;
void solve() {
  int N;
  cin >> N;
  vector<int> stack;
  int toremove = 1;
  int res = 0;
  set<int> reserved;
  for (auto i = (1); i <= (2 * N); ++i) {
    string op;
    cin >> op;
    {
      if (cond) {
        cerr << 41 << " "
             << "op"
             << " " << op << endl;
        cerr.flush();
      }
    };
    if (op == "add") {
      int x;
      cin >> x;
      {
        if (cond) {
          cerr << 45 << " "
               << "x"
               << " " << x << endl;
          cerr.flush();
        }
      };
      stack.push_back(x);
    } else {
      if (stack.size() == 0) {
      } else if (stack.back() == toremove) {
        stack.pop_back();
      } else {
        while (stack.size()) {
          stack.pop_back();
        }
        res++;
      }
      toremove++;
    }
  }
  cout << res << "\n";
}
int main(int argc, char** argv) {
  ios::sync_with_stdio(false);
  cond = argc >= 2 && argv[1][0] == 'q' ? 1 << 30 : 0;
  cout.setf(ios::fixed);
  cout.precision(10);
  int t;
  if (multi || gcj)
    cin >> t;
  else
    t = 1;
  for (auto i = (1); i <= (t); ++i) {
    if (cond) cerr << 74 << " " << i << endl;
    if (gcj) cout << "Case #" << i << ": ";
    solve();
  }
  return 0;
}
