#include <bits/stdc++.h>
using namespace std;
const int MAX = 2010;
int x[MAX], y[MAX];
int dist[MAX];
int Solve() {
int n;
scanf("%d", &n);
for (int i = 0; i < n; ++i)
scanf("%d %d", &x[i], &y[i]);
int ans = 0;
for (int i = 0; i < n; ++i) {
for (int j = 0; j < n; ++j) {
int dx = x[i] - x[j], dy = y[i] - y[j];
dist[j] = dx*dx + dy*dy;
}
sort(dist, dist+n);
int k = 0;
while (k < n) {
int cnt = 0;
int j = k+1;
while (j < n && dist[j] == dist[k])
++j;
cnt = j-k;
ans += cnt * (cnt-1) / 2;
k = j;
}
}
return ans;
}
int main() {
int ntests;
scanf("%d", &ntests);
for (int nt = 1; nt <= ntests; ++nt) {
printf("Case #%d: %d\n", nt, Solve());
}
return 0;
}
I2luY2x1ZGUgPGJpdHMvc3RkYysrLmg+CnVzaW5nIG5hbWVzcGFjZSBzdGQ7CmNvbnN0IGludCBNQVggPSAyMDEwOwppbnQgeFtNQVhdLCB5W01BWF07CmludCBkaXN0W01BWF07CgppbnQgU29sdmUoKSB7CiAgaW50IG47CiAgc2NhbmYoIiVkIiwgJm4pOwogIGZvciAoaW50IGkgPSAwOyBpIDwgbjsgKytpKQogICAgc2NhbmYoIiVkICVkIiwgJnhbaV0sICZ5W2ldKTsKICAKICBpbnQgYW5zID0gMDsKICBmb3IgKGludCBpID0gMDsgaSA8IG47ICsraSkgewogICAgZm9yIChpbnQgaiA9IDA7IGogPCBuOyArK2opIHsKICAgICAgaW50IGR4ID0geFtpXSAtIHhbal0sIGR5ID0geVtpXSAtIHlbal07CiAgICAgIGRpc3Rbal0gPSBkeCpkeCArIGR5KmR5OwogICAgfQogICAgc29ydChkaXN0LCBkaXN0K24pOwogICAgaW50IGsgPSAwOwogICAgd2hpbGUgKGsgPCBuKSB7CiAgICAgIGludCBjbnQgPSAwOwogICAgICBpbnQgaiA9IGsrMTsKICAgICAgd2hpbGUgKGogPCBuICYmIGRpc3Rbal0gPT0gZGlzdFtrXSkKICAgICAgICArK2o7CiAgICAgIGNudCA9IGotazsKICAgICAgYW5zICs9IGNudCAqIChjbnQtMSkgLyAyOwogICAgICBrID0gajsKICAgIH0KICB9IAogIHJldHVybiBhbnM7Cn0KCmludCBtYWluKCkgewogIGludCBudGVzdHM7CiAgc2NhbmYoIiVkIiwgJm50ZXN0cyk7CiAgZm9yIChpbnQgbnQgPSAxOyBudCA8PSBudGVzdHM7ICsrbnQpIHsKICAgIHByaW50ZigiQ2FzZSAjJWQ6ICVkXG4iLCBudCwgU29sdmUoKSk7CiAgfQogIHJldHVybiAwOwp9Cg==