#C12163. Second Largest Element in a List

    ID: 41560 Type: Default 1000ms 256MiB

Second Largest Element in a List

Second Largest Element in a List

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

Formally, let \( S \) be the set of distinct integers in the list. If \(|S| \ge 2\), output the second largest element in \( S \); otherwise, output \(None\).

inputFormat

The input is read from standard input (stdin) and consists of two lines:

  1. The first line contains an integer \( n \) representing the number of elements in the list.
  2. The second line contains \( n \) space-separated integers.

outputFormat

Output the second largest distinct number in the list on a single line. If no such number exists, print None.

## sample
5
10 4 3 2 10
4

</p>