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

let combi2 x =int64 x * int64 (x-1L) / 2L
//s |> Seq.map (fun str -> str.ToCharArray() |> Seq.countBy(fun x -> x ))
s |> Seq.map (fun str -> str.ToCharArray() |> Array.sort)
//|> Seq.countBy (fun x -> x |> Set.ofSeq)
|> Seq.fold (fun map cArray ->
    if map |> Map.containsKey cArray then map.Add(cArray,map.[cArray]+1) else map.Add(cArray,1) ) Map.empty
//|> Seq.sumBy (fun (_, count) -> combi2 <| int64 count)
|>Seq.sumBy (fun pair -> combi2 <| int64 pair.Value)
|> stdout.WriteLine