open System.Collections.Generic

let cnt = int(stdin.ReadLine())
let xs = Dictionary<string, int64>()

for i = 0 to cnt-1 do
    let str = new string (Array.sort (stdin.ReadLine().ToCharArray()))
    if (xs.ContainsKey str) then
        xs.[str] <- xs.[str] + 1L
    else
        xs.Add (str, 1L)

let mutable total = 0
for x in xs do
    let N = x.Value
    total <- total +  N*(N-1L)/2L

printfn "%d" total