Question
Minimum Energy
There are N people living on a number line. i-th person lives at coordinate Xi​. You are going to hold a meeting that all N people have to attend. The meeting can be held at any integer coordinate. If you choose to hold the meeting at coordinate P, the i- th person will spend (Xi − P)2 points of energy to attend the meeting. Find the minimum total energy the N people have to spend.
Input
The first line of the input consists of an integer N. The second line consists of N space separated integers denoting the co- ordinate where the people live.

Constraints
All values in input are integers.
1 ≤ N ≤ 100
1 ≤ Xi ≤ 100
Output
Print the minimum total energy the N people have to spend.
Example
Sample Input 1
2
1 4
Sample Output 1
5

Sample Input 2
7
14 14 2 13 56 2 37
Sample Output 2
2354

Online