n = gets.to_i
s = []
n.times do
  s << gets.chomp.split('').sort_by{|x| x}
end

count = 0
n.times do |i|
  j = i+1
  (j..n).each do |k|
    if s[i] == s[k]
      count += 1
    end
  end
end

print count