cho.sh
Notes
Loading...

High-Rise Buildings

Time limit

2s

Memory limit

128 MB

Problem

A city has N high-rise buildings standing in a row. The i-th building is represented by the vertical line segment from (i, 0) to its rooftop at (i, height_i).

Building B is visible from building A if the segment connecting their rooftops does not pass through or touch any building other than A and B.

For each building, count how many other buildings are visible from it. Output the maximum of those counts.

Input

The first line contains the number of buildings N. N is a natural number between 1 and 50, inclusive.

The second line contains the heights of buildings 1 through N, separated by spaces. Each height is a natural number between 1 and 1,000,000,000, inclusive.

Output

Output the maximum number of other buildings visible from a single building.