#include <bits/stdc++.h>
using namespace std;
int N, num, ans;
string s;
bool b[300010];
vector<int> V;
int main() {
  cin >> N;
  num = 1;
  for (int i = 1; i <= N * 2; i++) {
    cin >> s;
    if (s == "add") {
      int x;
      cin >> x;
      V.push_back(x);
    } else {
      if (!V.empty()) {
        if (V.back() == num)
          V.pop_back();
        else {
          ++ans;
          for (auto x : V) b[x] = true;
          while (!V.empty()) V.pop_back();
          b[num] = false;
        }
      } else
        b[num] = false;
      ++num;
    }
  }
  cout << ans << endl;
}
