#C13752. First Maximum Index Finder

    ID: 43325 Type: Default 1000ms 256MiB

First Maximum Index Finder

First Maximum Index Finder

You are given an array of integers. Your task is to determine the index of the first occurrence of the maximum value in the array. If the maximum value appears multiple times, return the smallest index at which it occurs. In the case when the array is empty, output -1.

Note: The index is 0-based.

Example:

Input: 7
       1 3 7 3 7 2 7
Output: 2

inputFormat

The first line contains a single integer n which indicates the number of elements in the array. The following line contains n space-separated integers representing the elements of the array. If n is 0, there will be no further input.

outputFormat

Output a single integer which is the index (0-based) of the first occurrence of the maximum value in the given array. If the input array is empty, output -1.

## sample
7
1 3 7 3 7 2 7
2