n = gets.to_i

as = []
n.times{
	as << gets.to_i
}

color_count = 0

while as.size > 0
	indexes = []
	temp = -1

	(0 ... as.size).each{ |x|
		if temp < as[x] then
			temp = as[x]
			indexes << x
		end
	}
	
	indexes.reverse.each{ |i|
		as.delete_at(i)
	}

	color_count += 1
end

puts color_count
