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

aaa = {}

S.each do |s|
  hoge = {}
  s.chars do |moji|
    if hoge[moji]
	  hoge[moji] += 1
    else
      hoge[moji] = 1
    end
  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