program green_bin
  implicit none
  integer :: n, c(100000,26) = 0, i, j, k
  logical :: used(100000) = .false.
  character(10) :: s
  integer(8) :: ans = 0_8, m
  read(*,*) n
  do i = 1, n
    read(*,*) s
    do j = 1, 10
      k = ichar(s(j:j))-96
      c(i,k) = c(i,k)+1
    end do
  end do
  do i = 1, n
    if (used(i)) cycle
    m = 0_8
    do j = i, n
      if (used(j)) cycle
      if (all(c(i,:) == c(j,:))) then
        used(j) = .true.
        m = m+1_8
      end if
    end do
    ans = ans+m*(m-1_8)/2_8
  end do
  write(*,'(i0)') ans
end program green_bin