#C9038. Median Quality Rating

    ID: 53087 Type: Default 1000ms 256MiB

Median Quality Rating

Median Quality Rating

Given a batch of products with their quality ratings represented as integers, your task is to compute the median of these ratings. First, sort the list of ratings. If the number of ratings n is odd, the median is the middle element.

If n is even, the median is computed using the formula:

$$ median = \frac{a_{\frac{n}{2}} + a_{\frac{n}{2}+1}}{2} $$

Note: In the computation above, the array is considered 1-indexed after sorting. The output must have exactly six digits after the decimal point, even if they are zeros.

inputFormat

The input is given through standard input (stdin) and consists of two lines:

  • The first line contains an integer n, the number of products.
  • The second line contains n space-separated integers representing the quality ratings of the products.

outputFormat

Print the median quality rating on a single line with exactly six digits after the decimal point.

## sample
3
1 3 2
2.000000

</p>