#include <iostream>
#include <string>
#include <map>
#include <algorithm>
using namespace std;

int d[6];

enum {
    NORTH,
    EAST,
    SOUTH,
    WEST
};

void run(int c) {
    switch (c) {
    case NORTH:
        swap(d[1], d[0]);
        swap(d[0], d[4]);
        swap(d[4], d[5]);
        break;
    case EAST:
        swap(d[3], d[0]);
        swap(d[0], d[2]);
        swap(d[2], d[5]);
        break;
    case SOUTH:
        swap(d[5], d[4]);
        swap(d[4], d[0]);
        swap(d[0], d[1]);
        break;
    case WEST:
        swap(d[2], d[0]);
        swap(d[0], d[3]);
        swap(d[3], d[5]);
        break;
    }
}

int main() {
    map<string, int> cmds;
    cmds["north"] = NORTH;
    cmds["east"]  = EAST;
    cmds["south"] = SOUTH;
    cmds["west"]  = WEST;
    int n;
    while (cin >> n, n) {
        for (int i = 0; i < 6; i++) {
            d[i] = i + 1;
        }
        for (int i = 0; i < n; i++) {
            string cmd;
            cin >> cmd;
            run(cmds[cmd]);
        }
        cout << d[0] << endl;
    }
}