let fact n = List.reduce (*) [1..n]

let n = stdin.ReadLine() |> int
[for i in 1..n do yield stdin.ReadLine() |> Seq.sort |> Seq.map string |> String.concat ""]
|> Seq.countBy (id)
|> Seq.sumBy (fun (key, i) ->
    if i >= 3 then
        (fact i) / (2 * (fact (i - 2)))
    else if i = 2 then
        1
    else
        0
        )
|> printfn "%d"
