Moo Network

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

문제

Farmer John's NN cows (1N1051 \leq N \leq 10^5) are spread far apart on his farm and would like to build a communication network so they can more easily exchange electronic text messages (all of which of course contain variations of "moo").

The iith cow is located at a distinct location (x_i,y_i)(x\_i,y\_i) where 0x_i1060 \leq x\_i \leq 10^6 and 0y_i100 \leq y\_i \leq 10. The cost of building a communication link between cows ii and jj is the squared distance between them: (x_ix_j)2+(y_iy_j)2(x\_i-x\_j)^2 + (y\_i-y\_j)^2.

Please calculate the minimum cost required to build a communication network across which all the cows can communicate. Two cows can communicate if they are directly connected by a link, or if there is a sequence of links along which their message can travel.

입력

The first line of input contains NN, and the next NN lines each describe the xx and yy coordinates of a cow, all integers.

출력

Please output the minimum cost of a network that will allow all cows to communicate. Note that this cost might be too large to fit into a 32-bit integer and may require use of 64-bit integers (e.g., "long long" integers in C++).