open System.Collections.Generic

let cnt = int(stdin.ReadLine()) - 1
let xs = List<string>()
let mutable total = 0
for i = 0 to cnt-1 do
    let hash = HashSet<string>()
    if i = 0 then
        let str = new string (Array.sort (stdin.ReadLine().ToCharArray()))
        xs.Add str
        hash.Add str |> ignore
        for j = i+1 to cnt do
            xs.Add (new string (Array.sort (stdin.ReadLine().ToCharArray())))
            if hash.Add xs.[j] then total <- total + 1
    else
        hash.Add xs.[i] |> ignore
        for j = i+1 to cnt do
            if hash.Add xs.[j] then total <- total + 1
printfn "%d" total