n = gets.to_i
strings = []
n.times { strings << gets.chars.sort.join }
hash = Hash.new { |h, k| h[k] = 0 }
ans = 0

strings.each { |str| hash[str] += 1 }

hash.each do |k, v|
  ans += (v-1..v).inject(:*) / 2 if v > 1
end

p ans
