N = gets.to_i
str =[]
N.times do
  str << gets.split('')
end

ans = 0
tmp = -1

str.each do |str1|
  str.each do |str2|
    if str1.sort == str2.sort
      tmp += 1
    end
  end
  ans += tmp
  tmp = -1
end

puts ans/2