Example

Input

3
y 7
y 6
n 5


Output

1
#include<cstdio>
#include<cstdlib>
#include<algorithm>
using namespace std;

inline char nc(){
  static char buf[100000],*p1=buf,*p2=buf;
  return p1==p2&&(p2=(p1=buf)+fread(buf,1,100000,stdin),p1==p2)?EOF:*p1++;
}
inline void read(int &x){
  char c=nc(),b=1;
  for (;!(c>='0' && c<='9');c=nc()) if (c=='-') b=-1;
  for (x=0;c>='0' && c<='9';x=x*10+c-'0',c=nc()); x*=b;
}
inline void read(char &x){
  for (x=nc();!(x>='a' && x<='z');x=nc());
}

const int N=1005;

int n,ans;
int a[N],b[N];

int main(){
  char order;
  read(n);
  for (int i=1;i<=n;i++){
    read(order); read(a[i]);
    if (order=='y') b[i]=1;
  }
  for (int i=1;i<=n;i++){
    int t=0;
    for (int j=1;j<=n;j++)
      if (b[j] && (!t || a[j]<a[t]))
	t=j;
    if (!t) break;
    for (int j=t-1;j;j--)
      if (!b[j] && a[j]>=a[t])
	break;
      else if (b[j])
	a[j]=-1;
    for (int j=t+1;j<=n;j++)
      if (!b[j] && a[j]>=a[t])
	break;
      else if (b[j])
	a[j]=-1;
    a[t]=-1;
    int pnt=0;
    for (int j=1;j<=n;j++)
      if (a[j]!=-1)
	a[++pnt]=a[j],b[pnt]=b[j];
    n=pnt;
    ++ans;
  }
  printf("%d\n",ans);
  return 0;
}