Kangaroo Party

아직 제출이 없습니다시간 제한1초메모리 제한512 MB

문제

A group of kangaroos live in houses on the number line. They all want to watch the Kangaroo Bowl!

Because not all of the kangaroos can fit a single house, they will designate two kangaroos to each host a party at their house. All other kangaroos will choose to go to the house that is closest to them, picking arbitrarily if they are the same distance from both.

A kangaroo expends (ab)2(a - b)^2 units of energy to travel from location aa to location bb. Compute the minimum total units of energy expended if the two party house locations are chosen optimally.

입력

The first line of input contains a single integer nn (2n502 \le n \le 50), which is the number of kangaroos.

Each of the next nn lines contains a single integer xx (1,000x1,000-1,000 \le x \le 1,000), which is the location on the number line of the house of one of the kangaroos. Each location will be distinct.

출력

Output, on a single line, the minimum total units of energy expended by all the kangaroos, given that the party house locations are chosen optimally.