while true
  n = gets.to_i
  break if n == 0
  d = Array.new(6){|i| i+1}
  ans = 1
  n.times do
    dir = gets.chomp 
    case dir
    when "North" then d[0],d[1],d[5],d[4] = d[1],d[5],d[4],d[0]
    when "South" then d[0],d[1],d[5],d[4] = d[4],d[0],d[1],d[5]
    when "West" then d[0],d[2],d[5],d[3] = d[2],d[5],d[3],d[0]
    when "East" then d[0],d[2],d[5],d[3] = d[3],d[0],d[2],d[5]
    when "Right" then d[1],d[2],d[4],d[3] = d[2],d[4],d[3],d[1]
    when "Left" then d[1],d[2],d[4],d[3] = d[3],d[1],d[2],d[4]
    end
    ans += d[0]
  end
  puts ans
end