Imports System.Collections.Generic
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 dict As Dictionary(Of String, Long) = New Dictionary(Of String, Long)
    Dim output As Long = 0
    For i As Long = 0 To n - 1
      Dim str As String = New String(s(i))
      If Not dict.ContainsKey(str) Then
        dict.Add(str, 1)
      Else
        dict(str) += 1
        output += dict(str) - 1
      End If
    Next
    Console.WriteLine(output.ToString())
  End Sub
End Class