#K47752. Mountain Array

    ID: 28268 Type: Default 1000ms 256MiB

Mountain Array

Mountain Array

Given an array of integers, determine if it is a mountain array. A mountain array is defined as an array that has a strict increase to a single peak followed by a strict decrease. The array must have at least three elements and the peak cannot be the first or the last element.

More formally, an array \( arr \) of length \( n \) is a mountain array if and only if there exists an index \( i \) with \( 0 < i < n-1 \) such that:

\( arr[0] < arr[1] < \cdots arr[i+1] > \cdots > arr[n-1] \).

inputFormat

The input is read from stdin and consists of two lines. The first line contains a single integer \( n \), representing the number of elements in the array. The second line contains \( n \) space-separated integers representing the elements of the array.

outputFormat

Print True if the array is a mountain array; otherwise, print False. The result should be output to stdout.

## sample
4
0 3 2 1
True