f = readlines
N = f[0].to_i
i = 1

while i <= N
  f[i] = f[i].chomp.chars.sort_by(&:downcase)
  i += 1
end

ans = 0

j = 1
while j < N
  k = j+1
  while k <= N
    if f[j] == f[k]
      ans += 1
    end
    k += 1
  end
  j += 1
end  

puts ans