Example

Input

3
y 7
y 6
n 5


Output

1
#include <bits/stdc++.h>

using namespace std;

#define int long long
#define all(v) begin(v), end(v)
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define reps(i, s, n) for(int i = (int)(s); i < (int)(n); i++)
#define min(...) min({__VA_ARGS__})
#define max(...) max({__VA_ARGS__})

const int inf = 1LL << 55;
const int mod = 1e9 + 7;

signed main()
{
  cin.tie(0);
  ios_base::sync_with_stdio(0);
  cout << fixed << setprecision(12);

  int n;
  cin >> n;
  char d[1010];
  int l[1010];
  vector< pair<int, int> > yes;
  rep(i, n) {
    cin >> d[i] >> l[i];
    if(d[i] == 'y') yes.push_back(make_pair(l[i], i));
  }
  sort(all(yes));
  bool used[1010] = {};
  int cnt = 0;
  rep(i, yes.size()) {
    int len, idx;
    tie(len, idx) = yes[i];
    if(used[idx]++) continue;
    int j = idx-1;
    while(j >= 0) {
      if(d[j] == 'n' && l[j] >= len) break;
      used[j]++; j--;
    }
    j = idx+1;
    while(j < n) {
      if(d[j] == 'n' && l[j] >= len) break;
      used[j]++; j++;
    }
    cnt++;
  }
  cout << cnt << endl;

  return 0;
}