program ABC_089_C_March
   implicit none
   integer N, i, j, k, a(1:5)
   integer(8)countN
   character(1) c, m(1:5)
   character(10), allocatable :: S(:)
   read(*, *) N
   allocate(S(1: N))
   do i = 1, N
       read(*, *) S(i)
   end do
   m(1) = 'M'
   m(2) = 'A'
   m(3) = 'R'
   m(4) = 'C'
   m(5) = 'H'
   a(:) = 0
   do j = 1, 5
       do i = 1, N
	       read(S(i), '(a1)') c
		   if( c == m(j) ) then
		       a(j) = a(j) + 1
		   end if
	   end do
   end do
   countN = 0
   do k = 1, 3
       do j = k, 3
	       do i = j, 3
		       countN = countN + a(k)*a(j+1)*a(i+2)
		   end do
	   end do
   end do
   write(*, *) countN
end program ABC_089_C_March