#include <bits/stdc++.h>
using namespace std;
long long Solve() {
int n;
scanf("%d", &n);
vector<int> x(n), y(n);
for (int i = 0; i < n; ++i)
scanf("%d %d", &x[i], &y[i]);
long long ans = 0;
for (int i = 0; i < n; ++i) {
unordered_map<int,int> dist_cnt;
for (int j = 0; j < n; ++j) {
int dx = x[i] - x[j], dy = y[i] - y[j];
++dist_cnt[dx*dx + dy*dy];
}
for (const auto& p : dist_cnt) {
ans += p.second * (p.second-1) / 2;
}
}
return ans;
}
int main() {
int ntests;
scanf("%d", &ntests);
for (int nt = 1; nt <= ntests; ++nt) {
printf("Case #%d: %lld\n", nt, Solve());
}
return 0;
}
I2luY2x1ZGUgPGJpdHMvc3RkYysrLmg+CnVzaW5nIG5hbWVzcGFjZSBzdGQ7Cgpsb25nIGxvbmcgU29sdmUoKSB7CiAgaW50IG47CiAgc2NhbmYoIiVkIiwgJm4pOwogIHZlY3RvcjxpbnQ+IHgobiksIHkobik7CiAgZm9yIChpbnQgaSA9IDA7IGkgPCBuOyArK2kpCiAgICBzY2FuZigiJWQgJWQiLCAmeFtpXSwgJnlbaV0pOwogIAogIGxvbmcgbG9uZyBhbnMgPSAwOwogIGZvciAoaW50IGkgPSAwOyBpIDwgbjsgKytpKSB7CiAgICB1bm9yZGVyZWRfbWFwPGludCxpbnQ+IGRpc3RfY250OwogICAgZm9yIChpbnQgaiA9IDA7IGogPCBuOyArK2opIHsKICAgICAgaW50IGR4ID0geFtpXSAtIHhbal0sIGR5ID0geVtpXSAtIHlbal07CiAgICAgICsrZGlzdF9jbnRbZHgqZHggKyBkeSpkeV07CiAgICB9CiAgICBmb3IgKGNvbnN0IGF1dG8mIHAgOiBkaXN0X2NudCkgewogICAgICBhbnMgKz0gcC5zZWNvbmQgKiAocC5zZWNvbmQtMSkgLyAyOwogICAgfQogIH0gCiAgcmV0dXJuIGFuczsKfQoKaW50IG1haW4oKSB7CiAgaW50IG50ZXN0czsKICBzY2FuZigiJWQiLCAmbnRlc3RzKTsKICBmb3IgKGludCBudCA9IDE7IG50IDw9IG50ZXN0czsgKytudCkgewogICAgcHJpbnRmKCJDYXNlICMlZDogJWxsZFxuIiwgbnQsIFNvbHZlKCkpOwogIH0KICByZXR1cm4gMDsKfQo=