#include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; #define ll __int64 #define ull unsigned long long #define maxn 10 #define pi acos(-1.0) int mp[maxn][maxn]; int dis(int x1,int y1,int x2,int y2){ return (x1-x2)*(x1-x2)+(y1-y2)*(y1-y2); } struct node { int x,y; }rr[maxn]; int findthree(){ int ans,res=0; for (int i=0;i<=8;i++){ for (int j=0;j<=8;j++){ if (mp[i][j]){ for (int p=0;p<=8;p++){ for (int q=0;q<=8;q++){ if (p==i && q==j) continue; if (mp[p][q]){ for (int u=0;u<=8;u++){ for (int v=0;v<=8;v++){ if (mp[u][v] && dis(u,v,p,q)==dis(u,v,i,j) && dis(u,v,p,q)==dis(i,j,p,q)){ res++; } } } } } } } } } return res/6; } bool check (int x){ if (x>=0 && x<=8) return true; return false; } int findfour (){ int ans,res=0; for (int i=0;i<=8;i++){ for (int j=0;j<=8;j++){ if (mp[i][j]){ for (int p=0;p<=8;p++){ for (int q=0;q<=8;q++){ if (p==i && q==j) continue; if (mp[p][q]){ ans=0; int x=q-j; int y=p-i; if (check(i-x) && check(j+y) && check(p-x) && check(q+y)){ if (mp[i-x][j+y] && mp[p-x][q+y]) ans++; } if (check(i+x) && check(j-y) && check(p+x) && check(q-y)){ if (mp[i+x][j-y] && mp[p+x][q-y]) ans++; }res+=ans;//printf("res=%d i=%d j=%d p=%d q=%d\n",res,i,j,p,q); } } } } } } return res/8; } int main() { int n; int x,y; while(scanf("%d",&n)!=EOF) { memset(mp,0,sizeof(mp)); for (int i=1;i<=n;i++){ scanf("%d%d",&x,&y); mp[x][y]++; } int rese=0; rese+=findthree(); rese+=findfour(); printf("%d\n",rese); } return 0; }