Example

Input

3
y 7
y 6
n 5


Output

1
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<iomanip>
#include<math.h>
#include<complex>
#include<queue>
#include<deque>
#include<stack>
#include<map>
#include<set>
#include<bitset>
#include<functional>
#include<assert.h>
#include<numeric>
using namespace std;
#define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)
using ll = long long;
const int inf=1e9+7;
const ll longinf=1LL<<60 ;
const ll mod=1e9+7 ;

int main(){
    int n;
    cin>>n;
    int u[n],l[n];
    vector<pair<int,int>> v;
    rep(i,n){
        char c;
        cin>>c;
        u[i]=(c=='y');
        cin>>l[i];
        if(u[i])v.emplace_back(l[i],i);
    }
    vector<int> used(n);
    sort(v.begin(),v.end());
    int ans=0;
    for(auto p : v){
        if(used[p.second])continue;
        ++ans;
        for(int i = p.second; i>=0;--i){
            if(!u[i]&&l[i]>=p.first)break;
            used[i]=true;
        }
        for(int i = p.second; i<n;++i){
            if(!u[i]&&l[i]>=p.first)break;
            used[i]=true;
        }
    }
    cout<<ans<<endl;
    return 0;
}
