Example

Input

3
y 7
y 6
n 5


Output

1
#include<bits/stdc++.h> 
using namespace std;
#define X first
#define Y second
#define pii pair<int,int>
#define rep(i,a,b) for (int i=a;i<=b;++i)
int n,res,l[1005],vis[1005];char d[1005];
vector<pii>V;
int main()
{
	scanf("%d",&n);
	rep(i,0,n-1)
	{
		scanf("\n%c %d",&d[i],&l[i]);
		if(d[i]=='y')V.push_back(make_pair(l[i],i));
	}
	sort(V.begin(),V.end());
	for(auto v:V)
	{
		if(vis[v.Y])continue;
		vis[v.Y]=1;res++;
		for(int i=v.Y-1;i>=0;i--)
		{
			if(d[i]=='n'&&v.X<=l[i])break;
			vis[i]=1;
		}
		for(int i=v.Y+1;i<n;i++)
		{
			if(d[i]=='n'&&v.X<=l[i])break;
			vis[i]=1;
		}
	}
	printf("%d\n",res);
	return 0;
}
