#include <bits/stdc++.h>
using namespace std;
void solve() {
  long long int n;
  cin >> n;
  set<long long int> st;
  long long int cnt = 1, ans = 0;
  long long int x = 2 * n;
  vector<long long int> v;
  while (x--) {
    string s;
    cin >> s;
    if (s[0] == 'a') {
      long long int y;
      cin >> y;
      v.push_back(y);
    } else {
      if (v.size() == 0) {
        cnt++;
        continue;
      }
      if (cnt == v.back()) {
        v.pop_back();
        cnt++;
      } else {
        ans++;
        v.clear();
        cnt++;
      }
    }
  }
  cout << ans << endl;
}
signed main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  cout.tie(nullptr);
  long long int t = 1;
  while (t--) {
    solve();
  }
}
