#include <bits/stdc++.h>
using namespace std;
const long long mod = 1000000007;
const long double pi = 3.14159265358979323846264338327950288419716939937510;
const long double eps = 1e-10;
const int oo = INT_MAX;
const long long ooo = LONG_LONG_MAX;
long long pwr(long long a, long long b, long long m) {
  long long res = 1 % m;
  a %= m;
  for (; b; b >>= 1) {
    if (b & (1LL)) res = res * a % m;
    a = a * a % m;
  }
  return res;
}
int n;
int arr[400010];
int top = 0;
void solve() {
  cin >> n;
  long long ans = 0;
  long long exp = 1;
  string s;
  int x;
  for (int i = 0; i < 2 * n; i++) {
    cin >> s;
    if (s == "add") {
      cin >> x;
      arr[++top] = x;
    } else {
      if (top && exp == arr[top]) {
        top--;
        exp++;
      } else {
        if (top) ans++;
        top = 0;
        exp++;
      }
    }
  }
  cout << ans << endl;
}
int main() {
  ios_base::sync_with_stdio(0);
  long long t = 1;
  while (t--) {
    solve();
  }
  return 0;
}
