#C13219. Find the Second Largest Number

    ID: 42733 Type: Default 1000ms 256MiB

Find the Second Largest Number

Find the Second Largest Number

You are given a list of numbers. Your task is to find the second largest distinct number in the list. If the list contains fewer than two distinct elements, output the error message:
List must contain at least two distinct elements.

In mathematical terms, if \( S \) is the set of distinct numbers from the input list, and \( S = {s_1, s_2, \dots, s_k} \) with \( s_1 > s_2 > \dots > s_k \), then you should output \( s_2 \) (provided that \( k \ge 2 \)).

inputFormat

The first line of input contains an integer n (\( n \ge 0 \)), representing the number of elements in the list. The second line contains n space-separated numbers. The numbers can be integers or floating-point values.

outputFormat

If the list contains at least two distinct numbers, output the second largest distinct number. Otherwise, output the exact error message:
List must contain at least two distinct elements.

## sample
5
4 2 5 1 3
4

</p>