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

def perm(n, k)
  ans = 1
  (0..(k-1)).each do |i|
    ans *= n-i
  end
  ans
end

aaa = {}

S.each do |s|
  hoge = {}
  ('a'..'z').each do |al|
    hoge[al.to_s] = 0
  end
  s.chars do |moji|
	hoge[moji] += 1
  end
  if aaa[hoge]
    aaa[hoge] += 1
  else
    aaa[hoge] = 1
  end
end

count = 0
aaa.values.each do |num|
  if num != 1
    count += num
  end
end

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

p count