Median

All submissions for this problem are available.
Given an array A[1..N] of N nonnegative integers, you need to find the median of the array.
The median of an array is the middle element in its sorted order. If N is even, choose the (N/2)^{th} element in the sorted order.
Input
The first line contains N, the number of integers in the array.
The next line has N integers, the elements in the array
Output
In a single line, output the median of the array.
Constraints
 1 <= N <= 10^{5}
 0 <= A_{i} <= 10^{6}
Example 1
Input 5 9 34 1 290 32 Output 32 ExplanationThe sorted order is [1, 9, 32, 34, 290]. The middle element is 32
Example 2
Input 6 17 13 10 1 3 1 Output 3 ExplanationThe sorted order is [1, 1, 3, 10, 13, 17]. The (N/2)^{th} element is 3.
Author:  shail.shah2 
Tags  shail.shah2 
Date Added:  25012015 
Time Limit:  1 sec 
Source Limit:  50000 Bytes 
Languages:  C, CPP14, JAVA, PYTH, PYTH 3.5, PYPY, CS2, PAS fpc, PAS gpc, RUBY, PHP, GO, NODEJS, HASK, SCALA, D, PERL, FORT, WSPC, ADA, CAML, ICK, BF, ASM, CLPS, PRLG, ICON, SCM qobi, PIKE, ST, NICE, LUA, BASH, NEM, LISP sbcl, LISP clisp, SCM guile, JS, ERL, TCL, PERL6, TEXT, SCM chicken, CLOJ, FS 
Comments
 Please login at the top to post a comment.
SUCCESSFUL SUBMISSIONS
Fetching successful submissions
HELP
If you are still having problems, see a sample solution here. 