#include <bits/stdc++.h>
using namespace std;
void printArr(int a[], int l, int r) {
  for (int i = l; i <= r; i++) {
    cout << a[i] << " ";
  }
  cout << endl;
}
void printMtx(int a[][1010], int n, int m) {
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= m; j++) {
      cout << a[i][j] << " ";
    }
    cout << endl;
  }
}
int n, cnt, x, cur;
string s;
stack<int> sta;
int main() {
  ios_base::sync_with_stdio(0);
  cin >> n;
  for (int i = 1; i <= 2 * n; i++) {
    cin >> s;
    if (s[0] == 'a') {
      cin >> x;
      sta.push(x);
    } else {
      cur++;
      if (!sta.empty()) {
        if (sta.top() == cur) {
          sta.pop();
        } else {
          while (!sta.empty()) {
            sta.pop();
          }
          cnt++;
        }
      }
    }
  }
  cout << cnt << endl;
}
