#K73177. Second Largest Unique Number

    ID: 33918 Type: Default 1000ms 256MiB

Second Largest Unique Number

Second Largest Unique Number

You are given a list of integers. Your task is to find the second largest unique number in the list. The input starts with an integer n which denotes the number of integers, followed by a line of n space-separated integers. If there are fewer than two distinct numbers in the list, output None.

Examples:

  • Input: 6 and [3, 1, 4, 4, 5, 2] → Output: 4
  • Input: 3 and [7, 7, 7] → Output: None
  • Input: 3 and [10, 5, 10] → Output: 5

inputFormat

The first line contains an integer n (the number of elements). The second line contains n space-separated integers.

outputFormat

Output the second largest unique integer. If there are fewer than two unique numbers, output None.

## sample
6
3 1 4 4 5 2
4