// I may fail a thousand times
// But there is no giving up
// IOI - here I come
#include <bits/stdc++.h>
#define int long long
using namespace std;
struct point{
	int x,y;
}a[1505];
struct seg{
	int len,dx,dy;
}b[1500*1500+5];
vector<int> vx,vy;
int res[1500*1500+5];
seg calc(point a,point b){
	seg ret;
	ret.len=(b.x-a.x)*(b.x-a.x)+(b.y-a.y)*(b.y-a.y);
	ret.dx=a.x-b.x;
	ret.dy=a.y-b.y;
	return ret;
}
int cmp(seg a,seg b){
	if(a.dx*b.dy<b.dx*a.dy)return 1;
	if(a.dx*b.dy==b.dx*a.dy)return a.len<=b.len;
	return 0;
}
int ccmp(point a,point b){
	if(a.x==b.x)return a.y<b.y;
	return a.x<b.x;
}
signed main(){
  ios_base::sync_with_stdio(0);cin.tie(0);
	int n;cin>>n;
	for(int i=0;i<n;i++)cin>>a[i].x>>a[i].y;
	sort(a,a+n,ccmp);
	int m=0;
	for(int i=0;i<n;i++){
		for(int j=i+1;j<n;j++){
			seg p=calc(a[i],a[j]);
			if(!p.dx||!p.dy){
				if(!p.dx)vx.push_back(p.len);
				else vy.push_back(p.len);
				continue;
			}
			b[m++]=p;
		}
	}
	sort(b,b+m,cmp);
	int j,ans=0;
	int lo=m;
	for(int i=0;i<m;i++){
		if(i&&b[i].dx*b[i-1].dy==b[i].dy*b[i-1].dx)if(b[i].len!=b[i-1].len)lo=m;
		if(!i||b[i].dx*b[i-1].dy!=b[i].dy*b[i-1].dx){
			j=i,lo=m;
		}
		for(;j<m&&b[j].dx*b[i].dy==b[j].dy*b[i].dx&&b[j].len<=4*b[i].len;){
			if(b[j].len==4*b[i].len)lo=min(lo,j);
			j++;
		}
		j--;
		if(b[j].len==b[i].len*4)res[i]=j-lo+1;
		ans=ans+res[i];
	}
	sort(vx.begin(),vx.end());
	j=0,lo=0;
	for(int i=0;i<(int)vx.size();i++){
		if(!i)j=i;
		if(!i||vx[i]!=vx[i-1])lo=(int)vx.size();
		for(;j<(int)vx.size()&&vx[j]<=4*vx[i];){
			if(vx[j]==4*vx[i])lo=min(lo,j);
			j++;
		}
		j--;
		if(vx[j]==vx[i]*4)ans=ans+j-lo+1;
	}
	sort(vy.begin(),vy.end());
	swap(vx,vy);
	j=0,lo=0;
	for(int i=0;i<(int)vx.size();i++){
		if(!i)j=i;
		if(!i||vx[i]!=vx[i-1])lo=(int)vx.size();
		for(;j<(int)vx.size()&&vx[j]<=4*vx[i];){
			if(vx[j]==4*vx[i])lo=min(lo,j);
			j++;
		}
		j--;
		if(vx[j]==vx[i]*4)ans=ans+j-lo+1;
	}
	cout<<ans<<'\n';
	return 0;
}