#include <iostream>
#include <cstdio>
#include <cstring>
using namespace std;

int a, b, c;

int solve(string s){
  int tmp;
  if(s == "north") tmp = b, b = a, a = 7-tmp;
  if(s == "east") tmp = a, a = c, c = 7-tmp;
  if(s == "west") tmp = c, c = a, a = 7-tmp;
  if(s == "south") tmp = a, a = b, b = 7-tmp;
  
  return a;
}

int main(){
  int n, ans;
  string op;
  while(cin >> n, n){
    a = 1, b = 2, c = 3;
    for(int i = 0 ; i < n ; i++){
      cin >> op;
      ans = solve(op);
    }
    cout << ans << endl;
  }
  return 0;
}