program march
  implicit none
  integer :: n, i, j, k
  integer(8) :: cnt(5) = 0_8, ans = 0_8
  character(10) :: s
  read(*,*) n
  do i = 1, n
    read(*,*) s
    select case (s(1:1))
    case ("M")
      cnt(1) = cnt(1)+1_8
    case ("A")
      cnt(2) = cnt(2)+1_8
    case ("R")
      cnt(3) = cnt(3)+1_8
    case ("C")
      cnt(4) = cnt(4)+1_8
    case ("H")
      cnt(5) = cnt(5)+1_8
    end select
  end do
  do i = 1, 3
    do j = i+1, 4
      do k = j+1, 5
        ans = ans+cnt(i)*cnt(j)*cnt(k)
      end do
    end do
  end do
  write(*,'(i0)') ans
end program march