n = gets.chomp.to_i
ary = [0,0,0,]
total_ary = []
while line = gets
line = line.chomp

if line == "HIT"
  ary[0] += 1
  if ary[0] > 3
    ary[0] = 3
    ary[1] += 1
  end
elsif line == "HOMERUN"
ary[1] += ary[0] + 1
ary[0] = 0
elsif line == "OUT"
ary[2] += 1
if ary[2] == 3
  total_ary << ary[1]
  ary = [0,0,0,0]
end
end
end
puts total_ary
