      PROGRAM march
      IMPLICIT NONE
      integer(16) :: n,ans=0
      character(10) :: s
      integer(16) :: i,j,k
      integer(16) :: m(5)
      
      m = 0
      read*,n
      do i = 1,n
        read*,s
        
        select case( s(1:1) )
        case( 'M' )
          m(1) = m(1) + 1
        case( 'A' )
          m(2) = m(2) + 1
        case( 'R' )
          m(3) = m(3) + 1
        case( 'C' )
          m(4) = m(4) + 1
        case( 'H' )
          m(5) = m(5) + 1
        end select
      end do
      
    !  print*,m
      
      do i=1,5
        do j = 1,5
          do k = 1,5
            if( i==j.or.j==k.or.k==i ) cycle
            if( i>j.or.j>k ) cycle
            ans = ans + m(i)*m(j)*m(k)
          end do
        end do
      end do
      
      print*,ans
      
      
      
      END PROGRAM