#CCBCHBAHAI0000148. Chỉ số của phần tử lớn nhất (Index of the Maximum Element)
Chỉ số của phần tử lớn nhất (Index of the Maximum Element)
Index of the Maximum Element
Source: C Primer Plus
Version: Phuoc Hung OJ Extended
Problem Statement
Given an integer array indexed from to , find the smallest index such that equals the maximum value of the array. Thus, when the maximum occurs more than once, choose its first occurrence.
Input
- The first line contains an integer .
- The second line contains integers .
Output
Print one integer, the -based index of the first occurrence of the maximum value.
Subtasks
Subtask 1 (100 points): and .
Examples
Input
7
4 9 2 9 7 1 9
Output
1
Explanation
The maximum value is , occurring at indices . The smallest of these indices is , so the answer is 1.