#include #include using namespace std; #define mp make_pair #define REP(A,B) for(int (A)=0;(A)<(B);(A)++) #define pb push_back int matched[3*1100*4]; #define ll long long int main() { int n; scanf("%d", &n); vector< pair > hs; map,int > S; n = 4*n; REP(i, n) { int x,y; scanf("%d%d", &x, &y); hs.pb(mp(x, y)); } sort(hs.begin(), hs.end()); REP(i, n) { S[mp(hs[i].first, hs[i].second)] = i; } long double ans = 0; REP(i, n) { if(matched[i]) continue; int closest = -1; long long closestdist = 1LL<<62; int o1 = -1; int o2 = -1; for(int j = i+1; j < n; j++) { if(matched[j]) continue; ll dx = (hs[j].first-hs[i].first); ll dy = (hs[j].second-hs[i].second); if(dx % 2 != dy % 2) continue; int xa = hs[i].first+(dx+dy)/2; int ya = hs[i].second+(-dx+dy)/2; int xb = hs[i].first+(dx-dy)/2; int yb = hs[i].second+(dx+dy)/2; if(!S.count(mp(xa,ya))) continue; if(!S.count(mp(xb,yb))) continue; int k1 = S[mp(xa,ya)]; int k2 = S[mp(xb,yb)]; /*printf("[%d %d] [%d %d]: [%d %d] [%d %d], k1=%d, k2=%d\n", hs[i].first, hs[i].second, hs[j].first, hs[j].second, xa, ya, xb, yb k1, k2);*/ if(matched[k1]) continue; if(matched[k2]) continue; long long cdist = dx*dx+dy*dy; if(cdist < closestdist) { closestdist = cdist; closest = j; o1 = k1; o2 = k2; } } //printf("%d %d %d %d\n", i, closest, o1, o2); matched[i] = matched[closest] = matched[o1] = matched[o2] = 1; //printf("%lld\n", closestdist); ans += closestdist/2.0L; } printf("%.8lf\n", (double)ans); return 0; }