#T204. 登山

登山

Description

May Day has arrived, and the ACM team has organized a mountain-climbing trip for sightseeing. The team members discovered that there are N scenic spots on the mountain and decided to visit them in order, meaning each subsequent spot must have a higher number than the previous one.

Additionally, the team has another climbing habit: they do not visit two consecutive spots with the same altitude, and once they start descending, they will not ascend again. The team hopes to visit as many scenic spots as possible while satisfying these conditions. Can you help them determine the maximum number of scenic spots they can visit?

Input Format

First line: N (2 ≤ N ≤ 1000), the number of scenic spots.
Second line: N integers representing the altitudes of each scenic spot.

Output Format

The maximum number of scenic spots that can be visited.

8
186 186 150 200 160 130 197 220


4