open Scanf

let rec for_iter a b f = if a >= b then [] else let x = f a in x :: for_iter (a+1) b f

let () =
  let arr = scanf "%d" (fun n -> Array.init n (fun _ -> scanf " %s" (fun s -> s.[0]))) in
  let ct = [|'M'; 'A'; 'R'; 'C'; 'H'|] |> Array.map (fun c ->
    arr |> Array.map (fun x -> if x = c then 1 else 0) |> Array.fold_left (+) 0) in
  for_iter 0 5 (fun x -> for_iter (x+1) 5 (fun y -> for_iter (y+1) 5 (fun z ->
    ct.(x) * ct.(y) * ct.(z)) |> List.fold_left (+) 0) |> List.fold_left (+) 0)
  |> List.fold_left (+) 0 |> Printf.printf "%d\n"
