#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;
}
