N = gets.chomp.to_i

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

s.sort!

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

    (self - k + 1..self).inject(:*) / k.factorial
  end

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

    (self - k + 1..self).inject(:*)
  end

  def factorial
    return 1 if self.zero?

    (1..self).inject(:*)
  end
end

tmp = 1
ans = 0
(N-1).times{|i|
  if s[i] == s[i+1]
    tmp += 1
  else
    ans += tmp.combination(2)
    tmp = 1
  end
  tmp_ary = i
}

ans += tmp.combination(2)

p ans
