#include<bits/stdc++.h>
#define ll long long
using namespace std;
ll ary[10000][2];
int caso;
vector<map<ll,ll>> maap;
ll dist(int i,int j){
ll x1,x2,y1,y2;
x1=ary[i][0],x2=ary[j][0];
y1=ary[i][1],y2=ary[j][1];
return (x1-x2)*(x1-x2) + (y1-y2)*(y1-y2);
}
int main(){
ios_base::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
cin>>caso;
for(int t=1;t<=caso;t++){
ll n;
cin>>n;
for(int i=0;i<n;i++)
cin>>ary[i][0]>>ary[i][1];
maap.clear();
maap.resize(2001);
ll resp=0;
for(int i=0;i<n;i++){
for(int j=i+1;j<n;j++){
ll d=dist(i,j);
maap[i][d]++;
maap[j][d]++;
}
}
for(int i=0;i<n;i++){
for(auto itr : maap[i]){
ll d=itr.second;
resp+=d*(d-1)/2;
}
}
cout<<"Case #"<<t<<": "<<resp<<'\n';
}
return 0;
}
I2luY2x1ZGU8Yml0cy9zdGRjKysuaD4KI2RlZmluZSBsbCBsb25nIGxvbmcKdXNpbmcgbmFtZXNwYWNlIHN0ZDsKbGwgYXJ5WzEwMDAwXVsyXTsKaW50IGNhc287CnZlY3RvcjxtYXA8bGwsbGw+PiBtYWFwOwpsbCBkaXN0KGludCBpLGludCBqKXsKICAgIGxsIHgxLHgyLHkxLHkyOwogICAgeDE9YXJ5W2ldWzBdLHgyPWFyeVtqXVswXTsKICAgIHkxPWFyeVtpXVsxXSx5Mj1hcnlbal1bMV07CiAgICByZXR1cm4gKHgxLXgyKSooeDEteDIpICsgKHkxLXkyKSooeTEteTIpOwp9CmludCBtYWluKCl7CiAgICBpb3NfYmFzZTo6c3luY193aXRoX3N0ZGlvKGZhbHNlKTsKICAgIGNpbi50aWUoMCk7CiAgICBjb3V0LnRpZSgwKTsKICAgIGNpbj4+Y2FzbzsKICAgIGZvcihpbnQgdD0xO3Q8PWNhc287dCsrKXsKICAgICAgICBsbCBuOwogICAgICAgIGNpbj4+bjsKICAgICAgICBmb3IoaW50IGk9MDtpPG47aSsrKQogICAgICAgICAgICBjaW4+PmFyeVtpXVswXT4+YXJ5W2ldWzFdOwoKICAgICAgICBtYWFwLmNsZWFyKCk7CiAgICAgICAgbWFhcC5yZXNpemUoMjAwMSk7CiAgICAgICAgbGwgcmVzcD0wOwogICAgICAgIGZvcihpbnQgaT0wO2k8bjtpKyspewogICAgICAgICAgICBmb3IoaW50IGo9aSsxO2o8bjtqKyspewogICAgICAgICAgICAgICAgbGwgZD1kaXN0KGksaik7CiAgICAgICAgICAgICAgICBtYWFwW2ldW2RdKys7CiAgICAgICAgICAgICAgICBtYWFwW2pdW2RdKys7CiAgICAgICAgICAgIH0KICAgICAgICB9CiAgICAgICAgZm9yKGludCBpPTA7aTxuO2krKyl7CiAgICAgICAgICAgIGZvcihhdXRvIGl0ciA6IG1hYXBbaV0pewogICAgICAgICAgICAgICAgbGwgZD1pdHIuc2Vjb25kOwogICAgICAgICAgICAgICAgcmVzcCs9ZCooZC0xKS8yOwogICAgICAgICAgICB9CiAgICAgICAgfQogICAgICAgIGNvdXQ8PCJDYXNlICMiPDx0PDwiOiAiPDxyZXNwPDwnXG4nOwogICAgfQpyZXR1cm4gMDsKfQo=