N = gets.chomp.to_i
s = []
N.times do |i|
  s << gets.chomp
end

h = {}

s.each do |ss|
  key = ss.split('').group_by { |a| a }.map { |k, v| [k, v.size] }.to_h
  h[key] ||= 0
  h[key] += 1
end

r = 0
h.each do |_, cnts|
  if cnts == 1
    next  # No pair
  elsif cnts == 2
    r += 1
  else # cnts > 2
    r += cnts * (cnts - 1) / 2
  end
end
p r