let cache = new System.Collections.Generic.Dictionary<_,_>()
let mutable count = 0
let sum s =
    match cache.TryGetValue s with
    | true, v -> cache.Remove(s) |> ignore; cache.Add(s, v + 1); count <- count + v
    | false, _ -> cache.Add(s, 1)

let n = stdin.ReadLine() |> int
[for i in 1..n do stdin.ReadLine() |> Seq.toList |> List.sort |> string |> sum]
printfn "%d" count
