#include <bits/stdc++.h>
using namespace std;
template <class T>
bool uin(T &a, T b) {
  return a > b ? (a = b, true) : false;
}
template <class T>
bool uax(T &a, T b) {
  return a < b ? (a = b, true) : false;
}
inline long long nxt() {
  long long x;
  cin >> x;
  return x;
}
namespace aux {
vector<string> split(const string &s, char c) {
  vector<string> v;
  stringstream ss(s);
  string x;
  while (getline(ss, x, c)) {
    v.emplace_back(x);
  }
  return v;
}
}  // namespace aux
int n;
list<int> curr;
bool sorted;
int main() {
  ios::sync_with_stdio(false);
  n = nxt();
  sorted = true;
  int ans = 0;
  int needr = 0;
  for (int i = 0; i < 2 * n; ++i) {
    string cmd;
    cin >> cmd;
    if (cmd == "add") {
      int x = nxt();
      curr.push_back(x);
    } else {
      needr++;
      if (curr.size() != 0) {
        if (curr.back() != needr) {
          ans++;
          curr.clear();
        } else {
          curr.pop_back();
        }
      }
    }
  }
  cout << ans << endl;
  return 0;
}
