#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using ii = pair<int, int>;
using vi = vector<int>;
using point = complex<ll>;
istream& operator>>(istream& is, point& p) {
  ll x, y;
  is >> x >> y;
  p = {x, y};
  return is;
}
ll dot(const point& a, const point& b) { return (conj(a) * b).real(); };
ll cross(const point& a, const point& b) { return (conj(a) * b).imag(); };
constexpr int N = 300010;
int n;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout << fixed << setprecision(15);
  cin >> n;
  stack<int> s;
  int ans = 0, cur = 1;
  for (int i = 0; i < 2 * n; ++i) {
    string str;
    cin >> str;
    if (str == "add") {
      int x;
      cin >> x;
      s.push(x);
    } else {
      if (!s.empty()) {
        if (s.top() == cur)
          s.pop();
        else {
          while (!s.empty()) s.pop();
          ++ans;
        }
      }
      ++cur;
    }
  }
  cout << ans;
}
