n = gets.to_i
array = []
for i in 1..n
  s = gets.chomp.split("")
  array.push(s.sort)
end

ctn = 0
for i in 0..array.combination(2).to_a.length - 1
  if array.combination(2).to_a[i][0] == array.combination(2).to_a[i][1]
    ctn += 1
  end
end

puts ctn