n = gets.to_i
i = 0
ss = []
while i < n do 
  ss << gets.chomp
  i += 1
end
ss.map!{|s| s.chars.sort.join}
i = 0
re = 0
sss = ""
ss.each.with_index do |s,c|
  sss = s if c == 0
  next if c == 0
  re += 1 if sss == s
end
p re