#K4251. Sum of Two Largest Distinct Numbers

    ID: 27103 Type: Default 1000ms 256MiB

Sum of Two Largest Distinct Numbers

Sum of Two Largest Distinct Numbers

You are given an array of integers. Your task is to find the sum of the two largest distinct numbers in the array. If there are fewer than two distinct integers, output None.

For example, given the array [10, 14, 2, 23, 19], the two largest distinct numbers are 23 and 19, and their sum is 42. In another case, for the array [1, 1, 1, 1], there are not enough distinct numbers, so the output should be None.

The input will be given via standard input and the output should be printed to standard output.

inputFormat

The first line of input contains a single integer n indicating the number of elements in the array. The second line contains n space-separated integers representing the array elements.

outputFormat

Output a single line: the sum of the two largest distinct integers in the array. If the array contains fewer than two distinct elements, output None.

## sample
5
10 14 2 23 19
42