Example

Input

3
y 7
y 6
n 5


Output

1
#include<bits/stdc++.h>
#define MAX 1024
#define inf 1<<29
#define linf 1e16
#define eps (1e-8)
#define mod 1000000007
#define pi acos(-1)
#define phi (1.0+sqrt(5))/2.0
#define f first
#define s second
#define mp make_pair
#define pb push_back
#define all(a) (a).begin(),(a).end()
#define pd(a) printf("%.10f\n",(double)(a))
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define RFOR(i,a,b) for(int i=(a)-1;(b)<=i;i--)
#define equals(a,b) (fabs((a)-(b))<eps)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef pair<int,double> pid;
typedef pair<double,int> pdi;
typedef vector<int> vi;
typedef vector<pii> vpi;
const int dx[8]={1,0,-1,0,1,1,-1,-1};
const int dy[8]={0,1,0,-1,1,-1,1,-1};

int n;
bool b[MAX];
int s[MAX];

int solve(){
  vpi vp;
  FOR(i,0,n)if(b[i])vp.pb(mp(s[i],i));
  sort(all(vp));
  int res=0;
  bool del[MAX]={};
  FOR(i,0,vp.size()){
    int index=vp[i].s;
    if(del[index])continue;
    res++;
    FOR(j,index+1,n){
      if(!b[j] && s[index]<=s[j])break;
      del[j]=true;
    }
    RFOR(j,index,0){
      if(!b[j] && s[index]<=s[j])break;
      del[j]=true;
    }
  }
  return res;
}

int main()
{
  cin>>n;
  FOR(i,0,n){
    string tmp;
    cin>>tmp>>s[i];
    b[i]=(tmp=="y" ? true : false);
  }
  cout<<solve()<<endl;
  return 0;
}