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={}

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)
  table.insert(s, tabtostr(si, 11))
end

ans=0
for i=1, n do
  for j=i, n do
    if s[i]==s[j+1] then
      ans=ans+1
    end
  end
end

print(ans)