n=gets.to_i
all=[]
n.times.each do
    v=gets.chomp.split("").map(&:to_s)
    v=v.tally
    all<<v
end
all_uni=all.uniq
result=0
for i in 0..all_uni.length-1
    v=all_uni[i]
    vv=all.count(v)
    if vv>=2
        
        vvv=[*1..vv].combination(2).to_a
        result+=vvv.length
    end
end
p result
