#include <bits/stdc++.h>
using namespace std;
const int MAXN = 3e5 + 10;
int n;
int order = 0, k = 0;
stack<int> values;
set<int> minimum;
int ans = 0, cur = 1;
int min(int a, int b) { return a < b ? a : b; }
int main() {
  scanf("%d\n", &n);
  minimum.insert(MAXN);
  string cmd;
  int x;
  for (int i = 0; i < 2 * n; i++) {
    cin >> cmd;
    if (cmd == "add") scanf("%d\n", &x);
    if (cmd == "add") {
      if (order == k && *minimum.begin() > x) {
        k++;
        order = k;
        minimum.insert(x);
      } else {
        k++;
        values.push(x);
        minimum.insert(x);
      }
    } else {
      if (order == k) {
        k--;
        order = k;
        minimum.erase(x);
      } else if (values.top() == cur) {
        values.pop();
        k--;
      } else {
        ans++;
        k--;
        order = k;
        while (!values.empty()) values.pop();
      }
      cur++;
    }
  }
  cout << ans << endl;
  return 0;
}
