P24637 [AtCoder] Next
入门
题目描述

Problem Statement

You are given $N integers A_1, A_2, \ldots, A_N.$ Find the largest among those integers that are not the largest.
The constraints of this problem guarantee that the answer exists.

Input

The input is given from Standard Input in the following format:
N
$A_1 A_2 \ldots A_N$

Output

Print the answer.

Constraints

  • $2 \leq N \leq 100$
  • $1 \leq A_i \leq 100$
  • It is not the case that all $A_1, A_2, \ldots, A_N$ are equal.
  • All input values are integers.

Sample Input 1

5
2 1 3 3 2

Sample Output 1

2

The largest integer among 2,1,3,3,2 is 3.
The integers that are not 3 among 2,1,3,3,2 are 2,1,2, among which the largest is 2.

Sample Input 2

4
4 3 2 1

Sample Output 2

3

Sample Input 3

8
22 22 18 16 22 18 18 22

Sample Output 3

18

输入格式

见题面 Input 部分

输出格式

见题面 Output 部分

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