#K13761. Maximum Building Height Index

    ID: 23985 Type: Default 1000ms 256MiB

Maximum Building Height Index

Maximum Building Height Index

Given a sequence of integers representing the heights of buildings in a row, determine the index of the building with the maximum height closest to the beginning of the list. If there are multiple buildings with the same maximum height, the earliest occurrence (i.e. the smallest index) should be returned.

The input is received via standard input. The first line contains an integer \(n\) representing the number of buildings. The second line contains \(n\) space-separated integers indicating the heights of the buildings. The output should be printed to standard output as a single integer representing the index (0-indexed) of the maximum-height building.

inputFormat

The first line contains an integer \(n\) which is the number of buildings.

The second line contains \(n\) space-separated integers, each representing the height of a building.

outputFormat

Output a single integer: the index (0-indexed) of the building with the maximum height closest to the beginning of the list.

## sample
1
7
0