P28303 [洛谷] Facer's Magic
提高
题目描述

Background

Facer accidentally ventured into a forbidden area and learned magic.

Problem Description

After entering the forbidden area, Facer encountered an opponent.

Specifically, Facer's magic is represented by a sequence of numbers.

However, Facer's abilities are limited, and this sequence can only be chosen from a given set of $n$ numbers. The magical value he can produce is the average of these selected numbers.

His opponent does not possess magic as powerful as Facer's, but he has a countermove. He finds the median from the numbers chosen by Facer, which is his magical value.

Determine how much magic Facer can maximally counter from his opponent.

In one sentence: Given $n$ numbers, you can choose any number of them to maximize the difference between the average and the median.

Input Format

The first line contains a positive integer $n$.

The second line contains $n$ numbers as described.

Output Format

Output the amount of magic Facer can counter from his opponent, rounded to two decimal places.

Sample Input and Output

Sample Input #1

4
1 2 3 4

Sample Output #1

0.33

Sample Input #2

4
1 2 3 9

Sample Output #2

2.00

Sample Input #3

2
1 2

Sample Output #3

0.00

Notes

  • For $20\%$ of the data, $n \leq 100$;
  • For $50\%$ of the data, $n \leq 2000$;
  • For $100\%$ of the data, $n \leq 10^5$, $0 \leq x_i \leq 10^6$.
输入格式

见题面 Input 部分

输出格式

见题面 Output 部分

样例输入
4 1 2 3 4
样例输出
0.33