#include <bits/stdc++.h>
using namespace std;
template <class T>
T min(T a, T b, T c) {
  return min(a, min(b, c));
}
template <class T>
T min(T a, T b, T c, T d) {
  return min(a, min(b, min(c, d)));
}
template <class T>
T max(T a, T b, T c) {
  return max(a, max(b, c));
}
template <class T>
T max(T a, T b, T c, T d) {
  return max(a, max(b, max(c, d)));
}
bool cmp(int a, int b) { return a > b; }
long long GCD(long long a, long long b) { return (a % b) ? GCD(b, a % b) : b; }
const string namePro = "tmp";
int main() {
  int n;
  scanf("%d", &n);
  int cnt = 0;
  int ans = 0;
  stack<int> stk;
  for (int i = (1); i <= (2 * n); ++i) {
    string s;
    cin >> s;
    if (s == "add") {
      int x;
      scanf("%d", &x);
      stk.push(x);
    } else {
      ++cnt;
      if (stk.size() && stk.top() == cnt)
        stk.pop();
      else if (stk.empty())
        continue;
      else {
        while (stk.size()) stk.pop();
        ++ans;
      }
    }
  }
  cout << ans << endl;
  return 0;
}
