#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
#pragma GCC target("avx,avx2,fma")
#pragma GCC optimization("unroll-loops")
const long long INF = 1e18;
using namespace std;
long long hcf(long long a, long long b) {
  if (b == 0) return a;
  return hcf(b, a % b);
}
unsigned long long stringtoll(string s) {
  unsigned long long ans = 0;
  for (unsigned long long i = 0; i < s.length(); i++) {
    ans = ans * 10 + (s[i] - '0');
  }
  return ans;
}
vector<long long> root(long long n) {
  vector<long long> ans;
  for (long long i = 2; i <= sqrt(n); i++) {
    if (n % i == 0) {
      ans.push_back(i);
      if (i != n / i) ans.push_back(n / i);
    }
  }
  return ans;
}
bool ifprime(long long n) {
  for (int i = 2; i <= sqrt(n); i++) {
    if (n % i == 0) return false;
  }
  return true;
}
long long logat(long long n, long long base) { return (log(n) / log(base)); }
long long factorial(long long n) {
  if (n == 0) return 1;
  return (n * factorial(n - 1)) % 1000000007;
}
void baspri(bool flag) {
  if (flag)
    cout << "YES"
         << "\n";
  else
    cout << "NO"
         << "\n";
}
long long lcm(long long a, long long b) { return (a / hcf(a, b)) * b; }
vector<pair<long long, long long>> prime_fact(long long n) {
  vector<pair<long long, long long>> ans;
  for (long long i = 2; i * i <= n; i++) {
    if (n % i == 0) {
      long long another = 0;
      while (n % i == 0) {
        n = n / i;
        another++;
      }
      ans.push_back({i, another});
    }
  }
  if (n > 1) ans.push_back({n, 1});
  return ans;
}
long long pw(long long n, long long r, long long mop) {
  long long res = 1;
  while (r != 0) {
    if (r % 2) {
      res = (res * n) % mop;
      r--;
    }
    n = (n * n) % mop;
    r = r / 2;
  }
  return res;
}
int query() {
  int t;
  cin >> t;
  return t;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  {
    int n;
    cin >> n;
    set<int> v;
    int ans = 0;
    vector<int> sop;
    for (long long i = 0; i < 2 * n; i++) {
      string s;
      int num;
      cin >> s;
      if (s == "add") {
        cin >> num;
        v.insert(num);
        sop.push_back(num);
      } else {
        if (!sop.empty() && sop.back() != *v.begin()) {
          ans++;
          sop.clear();
        }
        if (!sop.empty()) sop.pop_back();
        v.erase(v.begin());
      }
    }
    cout << ans << "\n";
  }
}
