Ss = readlines.drop(1).map(&:chomp)

@a = 'a'.ord
f = ->(s){s.codepoints.inject(0){|r, c| r + 10**(c - @a)}}
h = Ss.each_with_object(Hash.new{|h, k| h[k] = 0}){|s, o| o[f[s]] += 1}
puts h.values.inject(0){|r, v| r + (v*(v - 1))/2}