n=io.read("*n","*l")
counter={}
for i=1,n do
    s=io.read()
    t={}
    for i=1,10 do
        table.insert(t, s:sub(i,i))
        table.sort(t)
    end
    s_=table.concat(t)
    if not counter[s_] then
        counter[s_]=1
    else
        counter[s_]=counter[s_]+1
    end
end

total=0
for k,v in pairs(counter) do
    total=total+v*(v-1)//2
end
print(total)