#include <stdio.h>

int main(void) {
	int command_num;
	int i;
	char command[100];
	int top,bottom,north,south,east,west;
	int temp;
	while(1) {
		scanf("%d",&command_num);
		if(command_num==0)break;
		top=1;north=2;west=3;
		bottom=6;south=5;east=4;
		for(i=0;i<command_num;i++) {
			scanf("%s",command);
			switch(command[0]) {
				case 'n':
					temp=north;
					north=top;
					top=south;
					south=bottom;
					bottom=temp;
					break;
				case 's':
					temp=south;
					south=top;
					top=north;
					north=bottom;
					bottom=temp;
					break;
				case 'w':
					temp=west;
					west=top;
					top=east;
					east=bottom;
					bottom=temp;
					break;
				case 'e':
					temp=east;
					east=top;
					top=west;
					west=bottom;
					bottom=temp;
					break;
			}
		}
		printf("%d\n",top);
	}
	return 0;
}