function tabtostr(t, n)
  local s=""
  for i=1, n do
    s=string.format("%s%s", s, t[i])
  end
  return s
end

n=io.read("*n")
s={}
m={}
c=0

for i=1, n do
  si={}
  for j=1, 11 do
    table.insert(si, io.read(1))
  end
  table.sort(si, function(a, b) return a:upper() < b:upper() end)
  str=tabtostr(si, 11)
  if s[str]==nil then
    s[str]=0
    c=c+1
    table.insert(m, str)
  end
  s[str]=s[str]+1
end

ans=0
for i=1, c do
  n=s[m[i]]
  ans=ans+(n*(n-1)/2)
end

print(ans)