program probc
    implicit none
    integer::i,j,k,N,v(5)
    integer(16)::ans
    character(len=10)::S
    character::c(5) = (/"M","A","R","C","H"/)

    read(*,*) N
    v = 0
    do i = 1, N
        read(*,*) S
        do j = 1,5
            if(S(1:1) .eq. c(j)) then
                v(j) = v(j) + 1
            end if
        end do
    end do

    ans = 0
    do i = 1,3
        do j = 2,4
            do k = 3,5
                if(i < j .and. j < k)then
                    ans = ans + v(i)*v(j)*v(k)
                end if
            end do
        end do
    end do

    write(*,*) ans
    stop
end program