#include<bits/stdc++.h>
using namespace std;
int n;
struct node{
int x,y;
} spot[501];
bool check(node a, node b){
bool fc=false,fd=false;
node c={a.x-abs(a.y-b.y),a.y-abs(a.x-b.x)},d={b.x-abs(a.y-b.y),b.y-abs(a.x-b.x)};
for(int i=1;i<=n;i++){
if(spot[i].x == c.x && spot[i].y ==c.y){
fc=true;
}
if(spot[i].x == d.x && spot[i].y ==d.y){
fd=true;
}
}
if(fc && fd){
return true;
}
return false;
}
int main(){
ios::sync_with_stdio(false);
int cnt=0;
cin>>n;
for(int i=1;i<=n;i++){
cin>>spot[i].x>>spot[i].y;
}
for(int i=1;i<=n;i++){
for(int j=i;j<=n;j++){
if(check(spot[i],spot[j])){
cnt++;
}
}
}
cout<<cnt;
return 0;
}
全wa……