let solve m a r c h =
    m * a * r
    + m * a * c
    + m * a * h
    + m * r * c
    + m * r * h
    + m * c * h
    + a * r * c
    + a * c * h
    + r * c * h

let rec get_input_aux n solve m a r c h =
    if n = 0 then solve m a r c h
    else
        match (read_line ()).[0] with
        | 'M' -> get_input_aux (n - 1) solve (m + 1) a r c h
        | 'A' -> get_input_aux (n - 1) solve m (a + 1) r c h
        | 'R' -> get_input_aux (n - 1) solve m a (r + 1) c h
        | 'C' -> get_input_aux (n - 1) solve m a r (c + 1) h
        | 'H' -> get_input_aux (n - 1) solve m a r c (h + 1)
        |  _  -> get_input_aux (n - 1) solve m a r c h

let get_input n solve = get_input_aux n solve 0 0 0 0 0

let () =
    let n = read_int () in
    get_input n solve
    |> string_of_int
    |> print_endline
