open System.Linq;

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

s.Select(fun x -> new string (x.OrderBy(fun s -> s).ToArray())).GroupBy(fun s -> s).Select(fun g -> g.Count()).Where(fun c -> c > 1).Sum(fun c -> int64 c * int64 (c-1) / 2L)
|> stdout.WriteLine