N = gets.chop.to_i
S = []
N.times { S << gets.chomp }

aaa = {}
taiou = {}
('a'..'z').each_with_index do |str, ind|
  taiou[str] = 10**ind
end
base_num = taiou['z']*10

S.each do |s|
  hoge = base_num
  s.chars do |moji|
    hoge += taiou[moji]
  end
  if aaa[hoge]
    aaa[hoge] += 1
  else
    aaa[hoge] = 1
  end
end

count = 0
aaa.values.each do |num|
  count += num * (num -1) / 2
end

print count