require 'prime'

N = gets.chomp.to_i

s = []
N.times{|i|
  s[i] = gets.chomp.split("").sort
}

p s.sort!

class Integer

  def factorial
    return 1 if self.zero?

    x = 2 ** ( self - self.to_s(2).count("1"))

    y = 1
    for i in 3..self do

      if i.prime? then
        tmp = 0
        j = 1
        while self.div(i **j) > 0
          tmp += self.div(i ** j)
          j += 1
        end
        y *= i ** tmp
       end
    end
    x * y
  end

  def permutation(k)
    return 1 if k.zero?

    self.factorial.div((self - k).factorial)
  end

  def combination(k)
    return 1 if k.zero?

    self.permutation(k).div(k.factorial)
  end

end

count = 1
ans = 0
for i in 0...(N-1) do
  if s[i] == s[i+1]
    count += 1
  elsif count > 1
    ans += count.combination(2)
    count = 1
  end
end

ans += count.combination(2) if count > 1

p ans
