#K68717. Find the Second Largest Number

    ID: 32927 Type: Default 1000ms 256MiB

Find the Second Largest Number

Find the Second Largest Number

You are given a list of n integers. Your task is to find the second largest unique number in the list. More formally, for a given list \( A = \{a_1, a_2, \dots, a_n\} \), let \( L = \max A \). You need to determine \( S = \max\{ x \in A : x < L \} \). If there is no number less than \( L \) (i.e. the list contains fewer than 2 unique elements), print None.

Note: The input is provided via standard input and the output should be printed to standard output.

inputFormat

The input consists of two lines:

  1. The first line contains a single integer n (\(0 \le n \le 10^5\)), representing the number of elements.
  2. The second line contains n space-separated integers.

If n is 0, there will be no integers on the second line.

outputFormat

Output the second largest unique integer from the list. If no such number exists, output None.

## sample
8
3 1 4 1 5 9 2 6
6