#K69872. Calculate Median Salary

    ID: 33183 Type: Default 1000ms 256MiB

Calculate Median Salary

Calculate Median Salary

You are given a list of annual salaries of employees. Your task is to compute the median salary. The median is defined as the middle element after sorting the salaries in non-decreasing order. If there is an even number of employees, the median is the average of the two middle numbers. The answer must be rounded to one decimal place.

Mathematically, for an odd number of elements (n), the median is ( s_{\frac{n+1}{2}} ); for an even number of elements, it is ( \frac{s_{\frac{n}{2}} + s_{\frac{n}{2}+1}}{2} ), where ( s_i ) denotes the ( i )-th smallest salary.

inputFormat

The input is read from standard input (stdin). The first line contains a single integer (n), the number of employees. The second line contains (n) space-separated integers representing the annual salaries.

outputFormat

Output to standard output (stdout) the median salary as a float value rounded to one decimal place.## sample

5
55000 45000 70000 40000 60000
55000.0