N = gets.to_i S = N.times.map { gets.chomp } counter = Hash.new(0) S.each do |s| cnt = s.count('^') counter[cnt] += 1 end puts counter.max_by { |v, cnt| cnt }.first