[<AutoOpen>]
module Program

open System

let read f = stdin.ReadLine() |> f
let reada f = stdin.ReadLine().Split() |> Array.map f
let reads f = stdin.ReadLine().Split() |> Array.toList |> List.map f

let comb n r =
    if n = r then 1L
    elif r = 0L then 1L
    else
        let a = List.fold ( * ) 1L [n .. -1L .. n - r + 1L]
        let b = List.fold ( * ) 1L [r .. -1L .. 1L]
        a / b

[<EntryPoint>]
let main _ =
    let n = read int
    let xs =
        Array.init n (fun _ -> (read string).ToCharArray() |> Array.sort)
        |> Array.groupBy id
        |> Array.choose (fun x ->
                match (snd x |> Array.length) with
                | y when y > 1 -> Some (int64 y)
                | _ -> None
            )
    Array.fold (fun s x -> s + comb x 2L) 0L xs
    |> printfn "%i"
    0