program A320C
    implicit none
    integer(8)::N,i,j,k,C(5),ans
    character(10),allocatable,dimension(:)::S
    read*,N
    allocate(S(N))
    read*,S
    C=0
    ans=0
    do i=1,N
        if(S(i)(1:1)=="M")C(1)=C(1)+1
        if(S(i)(1:1)=="A")C(2)=C(2)+1
        if(S(i)(1:1)=="R")C(3)=C(3)+1
        if(S(i)(1:1)=="C")C(4)=C(4)+1
        if(S(i)(1:1)=="H")C(5)=C(5)+1
    end do
    do i=1,3
        do j=i+1,4
            do k=j+1,5
                ans=ans+C(i)*C(j)*C(k)
            end do
        end do
    end do

    print'(i0)',ans
end program A320C