Public Class Program
  Shared Sub Main()
    Dim n As Long = Long.Parse(Console.ReadLine())
    Dim s(0 To n - 1)() As Char
    For i As Long = 0 To n - 1
      s(i) = Console.ReadLine().ToCharArray()
      Array.Sort(s(i))
    Next
    Dim output As Long = 0
    For i As Long = 0 To n - 1
      For j As Long = i + 1 To n - 1
        If New String(s(i)) = New String(s(j)) Then output += 1
      Next
    Next
    Console.WriteLine(output.ToString())
  End Sub
End Class