#C11849. Second Largest Unique Number

    ID: 41210 Type: Default 1000ms 256MiB

Second Largest Unique Number

Second Largest Unique Number

Given a list of integers, your task is to determine the second largest unique number in the list. A unique number is defined as a distinct value in the list (duplicates are counted only once). Formally, if the set of unique numbers in the list is \(S\) and \(|S| \ge 2\), you need to output the number that is the second element when the numbers in \(S\) are arranged in descending order. If there is no such number (i.e. if the list contains fewer than two distinct numbers), output None.

inputFormat

The input is read from stdin and has the following format:

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

outputFormat

Print to stdout the second largest unique number in the list. If there is no valid answer, print None.

## sample
6
4 1 2 3 4 4
3