P26037 [AtCoder] [ABC365B] Second Best
入门
题目描述

Problem Description

Given an integer sequence $A=(A_1,\ldots,A_N)$ of length $ N $, where $A_1,A_2,\ldots,A_N$ are distinct.

What is the position of the second largest element in $ A $?

Input Format

The input is given from the standard input in the following format:

$ N $ $ A_1 $ $ A_2 $ $\ldots$ $ A_{N} $

Output Format

Output the integer $ X $ which is the position of the second largest element in $ A $.

Sample Input and Output

Sample Input #1

4
8 2 5 1

Sample Output #1

3

Sample Input #2

8
1 2 3 4 5 10 9 11

Sample Output #2

6

Notes/Hints

Constraints

  • $2\leq\ N\leq\ 100$
  • $1\leq\ A_i\ \leq\ 10^9$
  • $A_1,A_2,\ldots,A_N$ are distinct
  • All numbers input are integers

Sample Explanation 1

The second largest element in $ A $ is $ A_3 $, so output $ 3 $.

输入格式

见题面 Input 部分

输出格式

见题面 Output 部分

样例输入
4 8 2 5 1
样例输出
3