N = gets.to_i
s = N.times.map {
  gets.chomp.split(//).sort
}

def fact(n)
  return 1 if n == 0
  n * fact(n - 1)
end

s = s.group_by(&:itself).map {|k, v| [k, v.size]}

ans = s.inject(0) {|acc, (k, v)|
  next acc if v == 1
  acc += fact(v) / (fact(2) * fact(v - 2))
}

puts ans