#C5200. Average of Top Three Unique Temperatures

    ID: 48824 Type: Default 1000ms 256MiB

Average of Top Three Unique Temperatures

Average of Top Three Unique Temperatures

You are given a list of n integer temperatures. Your task is to calculate the average of the top three highest unique temperatures. If there are less than three unique temperatures, compute the average of all the unique temperatures available.

The average should be computed as the sum of the selected temperatures divided by their count. In mathematical notation, if the top unique temperatures are \(a_1, a_2, \dots, a_k\) then the answer is:

[ \text{average} = \frac{a_1 + a_2 + \cdots + a_k}{k} ]

It is guaranteed that at least one temperature is provided.

inputFormat

Standard input contains two lines. The first line contains an integer n representing the number of temperatures. The second line contains n space-separated integers representing the recorded temperatures.

outputFormat

Print a single floating-point number representing the average of the top three highest unique temperatures. If there are fewer than three unique temperatures, print the average of all unique temperatures.

## sample
7
30 30 32 33 31 29 28
32.0

</p>