#include<iostream>
using namespace std;
int main()
{
	long long n,x[1500],y[1500],i,j,brojac=0;
	cin>>n;
	for(i=1;i<=n;i++) cin>>x[i]>>y[i];
	if(n<4) cout<<0<<endl;
	else
	{
		for(i=1;i<n;i++)
			for(j=i+1;j<=n;j++)
			{
				if(x[i]==x[j]) brojac++;
				if(y[i]==y[j]) brojac++;
			}
	}
	cout<<brojac-1<<endl;
}