#include <bits/stdc++.h>
using namespace std;
int n, box, ans, element = 1000001;
set<int> boxes;
string second;
bool shuffl;
int main() {
  cin >> n;
  for (int i = 0; i < 2 * n; ++i) {
    cin >> second;
    if (second == "add") {
      cin >> box;
      if (!boxes.empty() && *boxes.begin() < box) {
        shuffl = 1;
        element = min(element, *boxes.begin());
      }
      boxes.insert(box);
    } else {
      if (shuffl && *boxes.begin() == element) {
        element = 1000001;
        shuffl = false;
        ans++;
      }
      boxes.erase(boxes.begin());
    }
  }
  cout << ans;
  return 0;
}
