#include <bits/stdc++.h>
using namespace std;
const int N = 2e5 + 10;
const int inf = 1e9;
const int mod = 1e9 + 7;
int main(int argc, char const *argv[]) {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(0);
  int n;
  cin >> n;
  int ans = 0;
  stack<int> st;
  int trash = 1;
  n *= 2;
  while (n--) {
    string s;
    int val;
    cin >> s;
    if (s == "add") {
      cin >> val;
      st.push(val);
    } else {
      if (st.empty()) {
        trash++;
        continue;
      }
      int tp = st.top();
      st.pop();
      if (tp != trash) {
        while (!st.empty()) st.pop();
        ans++;
      }
      trash++;
    }
  }
  cout << ans << '\n';
  return 0;
}
