N = gets.to_i ans = 0 N.times do a = gets.chomp.split.tally ans += 1 if %w(akai marui okii umai).all? { |key| a[key] == 1 } end p ans