implicit none
integer :: n,i,j,k
integer(16) :: ans
character(10) :: s
integer(16),allocatable :: p(:)
logical :: flg

read *,n
allocate(p(n))

p(:) = 0
do i = 1,n
   read *,s
   flg = .true.
   do j = 2, 10
      if (s(j:j) /= s(1:1)) then
         flg = .false.
         exit
      endif
   enddo
   if (flg) then
      p(i) = 1
   endif
   do j = 1, 10
      if (s(j:j) == 'a') then 
         k = 1
      else if (s(j:j) == 'b') then 
         k = 2
      else if (s(j:j) == 'c') then 
         k = 3
      else if (s(j:j) == 'd') then 
         k = 4
      else if (s(j:j) == 'e') then 
         k = 5
      else if (s(j:j) == 'f') then 
         k = 6
      else if (s(j:j) == 'g') then 
         k = 7
      else if (s(j:j) == 'h') then 
         k = 8
      else if (s(j:j) == 'i') then 
         k = 9
      else if (s(j:j) == 'j') then 
         k = 10
      else if (s(j:j) == 'k') then 
         k = 11
      else if (s(j:j) == 'l') then 
         k = 12
      else if (s(j:j) == 'm') then 
         k = 13
      else if (s(j:j) == 'n') then 
         k = 14
      else if (s(j:j) == 'o') then 
         k = 15
      else if (s(j:j) == 'p') then 
         k = 16
      else if (s(j:j) == 'q') then 
         k = 17
      else if (s(j:j) == 'r') then 
         k = 18
      else if (s(j:j) == 's') then 
         k = 19
      else if (s(j:j) == 't') then 
         k = 20
      else if (s(j:j) == 'u') then 
         k = 21
      else if (s(j:j) == 'v') then 
         k = 22
      else if (s(j:j) == 'w') then 
         k = 23
      else if (s(j:j) == 'x') then 
         k = 24
      else if (s(j:j) == 'y') then 
         k = 25
      else if (s(j:j) == 'z') then 
         k = 26
      endif
      p(i) = p(i) + 10**k
   enddo
enddo

ans = 0
do i = 1, n-1
   do j = i+1, n
      if (p(i) == p(j)) ans = ans + 1
   enddo
enddo

print '(i0)',ans
end