102131: [AtCoder]ABC213 B - Booby Prize

Memory Limit:256 MB Time Limit:2 S
Judge Style:Text Compare Creator:
Submit:1 Solved:0

Description

Score : $200$ points

Problem Statement

$N$ players, who are numbered $1, \ldots, N$, have played a game. Player $i$ has scored $A_i$, and a player with a smaller score ranks higher.

The player who ranks the second lowest will receive a booby prize. Who is this player? Answer with an integer representing the player.

Constraints

  • $2 \leq N \leq 2\times 10^5$
  • $1 \leq A_i \leq 10^9$
  • $A_i$ are distinct.
  • All values in input are integers.

Input

Input is given from Standard Input in the following format:

$N$
$A_1$ $\ldots$ $A_N$ 

Output

Print the answer.


Sample Input 1

6
1 123 12345 12 1234 123456

Sample Output 1

3

It is Player $3$ who ranks fifth among the six players.


Sample Input 2

5
3 1 4 15 9

Sample Output 2

5

Input

题意翻译

输入 $n$ 个整数,输出这 $n$ 个整数中**倒数第二大的整数在原数列中是第几个**。

Output

得分:200分

问题描述

编号为1, \ldots, N 的N名选手进行了一场比赛。选手i的得分为$A_i$,得分较< strong>小 的选手排名更高。

排名倒数第二的选手将获得安慰奖。这个选手是谁?以表示选手的整数形式回答。

约束

  • $2 \leq N \leq 2\times 10^5$
  • $1 \leq A_i \leq 10^9$
  • $A_i$互不相同。
  • 输入中的所有值都是整数。

输入

输入按照以下格式从标准输入给出:

$N$
$A_1$ $\ldots$ $A_N$ 

输出

打印答案。


样例输入1

6
1 123 12345 12 1234 123456

样例输出1

3

在6名选手中,选手3排名第五。


样例输入2

5
3 1 4 15 9

样例输出2

5

加入题单

上一题 下一题 算法标签: