open System.Collections.Generic
open System.Linq

let baseIndex = int 'a'
let toIndex (c:char) = int c - baseIndex
let toArray str = 
    let ary = [| for _ in 0..26 -> 0 |]
    for c in str do
        let p = toIndex c
        ary.[p] <- ary.[p]+1
    ary
let cnt = int(stdin.ReadLine()) - 1
let xs = List<int[]>(cnt)
let mutable total = 0
for i = 0 to cnt-1 do
    if i = 0 then
        xs.Add (toArray (stdin.ReadLine()))
        for j = i + 1 to cnt do
            xs.Add (toArray (stdin.ReadLine()))
            if  xs.[i].SequenceEqual xs.[j] then total <- total + 1
    else
        for j = i+1 to cnt do
           if  xs.[i].SequenceEqual xs.[j] then total <- total + 1
printfn "%d" total