# Cable Car

The Titiwangsa Mountains is a mountain range that forms the backbone of the Malay Peninsula. The Malaysian Cable Car (MCC) society has decided to build a cable car ropeway somewhere along the undeveloped mountain range, and has hired Fluffy the Squirrel to help with designing the ropeway.

There are $$N$$ mountains of heights $$h_1, h_2, \ldots , h_N$$ meters. Fluffy has to select two mountains to be the terminal stations. All the mountains in between the two selected mountains must be strictly shorter than both selected mountains, or else it would not be possible to build the ropeway.

To maximise the enjoyment of the ride, Fluffy wants to build the longest possible cable car ropeway. The length of a ropeway formed by selecting the $$i^\text{th}$$ and $$j^\text{th}$$ mountains $$(i \neq j)$$ is defined as $$| j - i |$$. Your task is to help Fluffy determine the length of the longest possible cable car ropeway from the 6 mountains below.

 1 3 4 1 2 5 6 

×