#abc365b. B - Second Best

B - Second Best

Score : 200200 points

问题陈述

给定一个长度为 NN 的整数序列 A=(A1,,AN)A=(A_1,\ldots,A_N)。这里,A1,A2,,ANA_1, A_2, \ldots, A_N 都是不同的。

AA 中哪个元素是第二大的?

以上为大语言模型 kimi 翻译,仅供参考。

Problem Statement

You are given an integer sequence A=(A1,,AN)A=(A_1,\ldots,A_N) of length NN. Here, A1,A2,,ANA_1, A_2, \ldots, A_N are all distinct.

Which element in AA is the second largest?

Constraints

  • 2N1002 \leq N \leq 100
  • 1Ai1091 \leq A_i \leq 10^9
  • A1,A2,,ANA_1, A_2, \ldots, A_N are all distinct.
  • All input values are integers.

Input

The input is given from Standard Input in the following format:

NN

A1A_1 A2A_2 \ldots ANA_{N}

Output

Print the integer XX such that the XX-th element in AA is the second largest.

Sample Input 1

4
8 2 5 1

Sample Output 1

3

The second largest element in AA is A3A_3, so print 33.

Sample Input 2

8
1 2 3 4 5 10 9 11

Sample Output 2

6