#include<iostream>
#include<string>
using namespace std;
int sai[100000][6];
int x[100000];
int main() {
	while (true) {
		int y[6] = { 1,5,4,3,2,6 };
		string S; int n;
		cin >> n; if (n == 0)break;
		for (int i = 0; i < 100000; i++) {
			x[i] = 0; for (int j = 0; j < 6; j++)sai[i][j] = 0;
		}
		for (int i = 0; i < n; i++) {
			cin >> S;
			if (S == "north") { x[i + 1] = 0; }
			if (S == "east") { x[i + 1] = 1; }
			if (S == "south") { x[i + 1] = 2; }
			if (S == "west") { x[i + 1] = 3; }
		}
		for (int i = 0; i < 6; i++) { sai[0][i] = y[i]; }
		for (int i = 1; i <= n; i++) {
			if (x[i] == 2) {
				sai[i][0] = sai[i - 1][4]; sai[i][1] = sai[i - 1][0]; sai[i][2] = sai[i - 1][2];
				sai[i][3] = sai[i - 1][3]; sai[i][4] = sai[i - 1][5]; sai[i][5] = sai[i - 1][1];
			}
			if (x[i] == 3) {
				sai[i][0] = sai[i - 1][2]; sai[i][1] = sai[i - 1][1]; sai[i][2] = sai[i - 1][5];
				sai[i][3] = sai[i - 1][0]; sai[i][4] = sai[i - 1][4]; sai[i][5] = sai[i - 1][3];
			}
			if (x[i] == 0) {
				sai[i][0] = sai[i - 1][1]; sai[i][1] = sai[i - 1][5]; sai[i][2] = sai[i - 1][2];
				sai[i][3] = sai[i - 1][3]; sai[i][4] = sai[i - 1][0]; sai[i][5] = sai[i - 1][4];
			}
			if (x[i] == 1) {
				sai[i][0] = sai[i - 1][3]; sai[i][1] = sai[i - 1][1]; sai[i][2] = sai[i - 1][0];
				sai[i][3] = sai[i - 1][5]; sai[i][4] = sai[i - 1][4]; sai[i][5] = sai[i - 1][2];
			}
		}
		cout << sai[n][0] << endl;
	}
	return 0;
}