#C14923. Find the Second Largest Number

    ID: 44626 Type: Default 1000ms 256MiB

Find the Second Largest Number

Find the Second Largest Number

You are given a list of integers. Your task is to find the second largest distinct number in the list. If the list has fewer than two distinct numbers, output None.

For example, given the list [3, 1, 4, 1, 5, 9, 2, 6], the largest number is 9 and the second largest distinct number is 6. However, for a list like [3, 3, 3] or a list with a single element, there is no valid second largest number, so you should output None.

Note: The input is provided via standard input (stdin) and the output should be printed to standard output (stdout). Use the appropriate methods for input and output in your chosen programming language.

inputFormat

The input begins with a single integer n on the first line, representing the number of elements in the list. If n > 0, the second line contains n space-separated integers. If n is 0, the second line may be omitted.

outputFormat

Print a single line containing the second largest distinct number from the list. If the list doesn't contain at least two distinct numbers, print None.

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