UVa 10107 - What is the Median?

Summary
Summary of the problem statement goes here.

Explanation
Explanation of the ideas behind the solution goes here.

Gotchas

 * Any points one can easily overlook?
 * The correct way to understand ambiguous formulations?

Implementations
Notes/Hints on actual implementation here.

Optimizations
Optimizations here.

Input
1 3 4 60 70 50 2

Output
1 2 3 3 4 27 4