#include #include #include using namespace std; #define DEB(x) cout << #x << " = " << x << endl; int xy[100001][2]; int main(void) { int n; while (scanf("%d", &n) == 1) { for (int i = 0; i < n; i++) { scanf("%d %d", &xy[i][0], &xy[i][1]); } double all = (double)n * (double)n; //cout << all << endl; uint64_t cnt = 0; for (int i = 0; i < n; i++) { for (int j = 0; j < n; j++) { if (i == j) continue; int dx = abs(xy[i][0] - xy[j][0]); int dy = abs(xy[i][1] - xy[j][1]); if (dx == dy) { cnt++; } } } //DEB(cnt); double res = cnt / (double)all; printf("%.6lf\n", res); } return 0; }