N=gets.to_i
S=N.times.map{gets.chomp.chars.sort.join("")}
#N=10**5
#S=N.times.map{("abcdefghij").chars.sort}

checked=Array.new(N, false)
ans=0
(0..N-2).each do |i|
  next if checked[i]
  cnt=1
  (i+1..N-1).each do |j|
    next if checked[j]
    if S[i] == S[j]
      cnt += 1
      checked[j] = true
    end
  end
  ans+=cnt*(cnt-1)/2
end
p ans
