#include <bits/stdc++.h>
using namespace std;
template <typename Arg1>
void __f(const char* name, Arg1&& arg1) {
  cerr << name << " : " << arg1 << std::endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args) {
  const char* comma = strchr(names + 1, ',');
  cerr.write(names, comma - names) << " : " << arg1 << " | ";
  __f(comma + 1, args...);
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int n;
  cin >> n;
  int torm = 1;
  set<int> s;
  stack<int> st;
  int ans = 0;
  for (int i = 0; i < 2 * n; i++) {
    string command;
    int val;
    cin >> command;
    if (command == "add") {
      cin >> val;
      st.push(val);
      continue;
    }
    if (!st.empty() && torm == st.top())
      st.pop(), torm++;
    else {
      if (!st.empty()) {
        ans++;
        while (!st.empty()) s.insert(st.top()), st.pop();
      }
      assert(torm == *s.begin());
      s.erase(s.begin());
      torm++;
    }
  }
  cout << ans << '\n';
  return 0;
}
