#include <bits/stdc++.h>
using namespace std;
const int INF = 2e9 + 10;
const int MOD = 1e9 + 7;
const int N = 1e6 + 10;
int n, m, b;
vector<int> st;
int main() {
  ios_base::sync_with_stdio(0);
  cout.tie(0);
  cin.tie(0);
  cin >> n;
  int cnt = 0;
  int ans = 0;
  for (int i = 1; i <= 2 * n; i++) {
    string t;
    int val;
    cin >> t;
    if (t == "add") {
      cin >> val;
      st.push_back(val);
    } else {
      cnt++;
      if (st.empty())
        ;
      else if (st.back() == cnt)
        st.pop_back();
      else {
        st.clear();
        ans++;
      }
    }
  }
  cout << ans;
  return 0;
}
