let n = stdin.ReadLine() |> int
let s = [| for _ in 1.. n -> stdin.ReadLine()|]

let combi2 x =x*(x-1)/2
s |> Array.map (fun str -> str.ToCharArray() |> Array.countBy(fun x -> x ))
|> Array.countBy (fun x -> x |> Set.ofArray)
|> Array.sumBy (fun (_, count) -> combi2 count)
|> stdout.WriteLine