13831 - Visiting Friends   

Description

Stiff Waist Beast is a electric god in NTHU CS. He has lots of friends. All his friends live on Tsing Hua Street. the i-th friend lives in number ai. We define D as the sum of the distances from him to his friends' homes. 

One day, Stiff Waist Beast is going to move to the street. Since he often goes to visit his friends, so he wants to move to a place on Tsing Hua Street such that D is the smallest. Can you help him find the place? 

(There might be some people lives in the same place, since every building has many floors.)

Input

The first line has one integer N, means Stiff Waist Beast has n friends. 

The next line has N integers a1 a... aN.

1 <= N <= 2e5. 

0 <= ai <= 1e9.

Output

Please output the place Stiff Waist Beast should move to and the smallest D.

(If there are multiple places make D the smallest, please output the smallest one.)

 

 

Some examples:

Input: 
4
6 7 9 1
Output:
6 9
 
Input: 
8
3 3 5 6 8 4 6 1
Output:
4 14
 
Input:
7
50 61 62 1 3 1 1
Output:
3 170
 

Sample Input  Download

Sample Output  Download

Tags

Stiff Waist Beast



Discuss