#!/usr/bin/env ruby
n, = ARGF.gets.split.map {|x| x.to_i}
s = (1..n).map{ ARGF.gets.split('').sort.join }
sum = 0
s.each do |s1|
  s.each do |s2|
    if s1 == s2
      sum += 1
    end
  end
end
puts (sum - s.length) / 2
