Whats wrong in this solution?

Hey… I’m currently trying to solve Median Rearrangement (MEDMAX) problem from October lunchtime. But I’m getting wrong answer. Can someone tell me what’s wrong with my solution? I’m stuck in this problem for a day. That would be a great help.

Language - Python

My Submission - CodeChef: Practical coding for everyone