Example

Input

3
y 7
y 6
n 5


Output

1
#include<iostream>
#include<algorithm>
#include<vector>
using namespace std;
int main(){
  int n;
  //in
  cin >> n;
  pair<int,int> b;
  vector<pair<char,int> >a(n,pair<char,int>(0,0));
  vector<pair<int,int> >y;
  vector<bool> del(n,0);
  int c=0;
  for(int i=0;i<n;i++){
    cin >> a[i].first >> a[i].second;
    if(a[i].first=='y'){
      b.first=a[i].second;
      b.second=i;
      y.push_back(b);
    }
  }
  //syori
  sort(y.begin(),y.end());
  for(int i=0;i<y.size();i++){
    if(del[y[i].second]==1)continue;
    c++;
    for(int j=y[i].second;j<a.size();j++){
      if(a[j].first=='n'&&a[j].second>=y[i].first)break;
      else{
	del[j]=1;
      }
    }
    for(int j=y[i].second;j>=0;j--){
      if(a[j].first=='n'&&a[j].second>=y[i].first)break;
      else{
	del[j]=1;
      }
    }
  }
  cout << c << endl;
  return 0;
}