n = gets.strip.to_i
s = n.times.map{ gets.strip.split('') }

ords = []
("a".ord*10.."z".ord*10).each do |i|
  ords[i] = 0
end

ans = 0
s.each do |st|
  num = 0
  st.map{|m| num += m.ord}
  ords[num] += 1
  ans += ords[num] - 1
end

puts ans