# https://atcoder.jp/contests/abc137/tasks/abc137_c



N = gets.to_i
ss = Array.new(N) { gets.chomp }

tbl = Hash.new(0)
ss.each { |s| tbl[s.chars.sort.join] += 1 }
ans = tbl.values.reduce(0) { |m, k| m + k * (k - 1) / 2}

puts ans
