#include<iostream>
using namespace std;

#define rotate_swap(x,a,b,c,d) swap(x.a,x.b);swap(x.b,x.c);swap(x.c,x.d);

struct dice{
  int top,front,right,left,back,bottom;
};
void rotate_r(dice &x){rotate_swap(x,top,left,bottom,right);}
void rotate_l(dice &x){rotate_swap(x,top,right,bottom,left);}
void rotate_f(dice &x){rotate_swap(x,top,back,bottom,front);}
void rotate_b(dice &x){rotate_swap(x,top,front,bottom,back);}

int main()
{
  int n;
  while(cin >> n){
    if(n==0)break;

    dice d;
    d.top = 1;
    d.front = 2;
    d.left = 3;
    d.bottom = 6;
    d.back = 5;
    d.right = 4;
    for(int i = 0; i < n; ++i){
      string in;
      cin >> in;
      if(in=="north"){
        rotate_f(d);
      }else if(in=="east"){
        rotate_r(d);
      }else if(in=="west"){
        rotate_l(d);
      }else if(in=="south"){
        rotate_b(d);
      }

    }
    cout << d.top << endl;
  }
  
  return 0;
}