lines = readlines
n = lines[0].chomp.to_i

arr = []
for i in 1..n do
  arr << lines[i].chomp.chars.sort_by! {|a, b|a}
end

counter = 0
for j in 0..n-1 do
  if j < arr.length - 1
    for k in j+1..n-1
      if arr[k] == arr[j]
        counter += 1
      end
    end
  end
end

puts counter