#include <bits/stdc++.h>
#define int long long
#define N 200000+10
#define mod 1000000007
using namespace std;
struct Hole
{
int x,y;
}h[N];
signed main()
{
ios::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
int n;
cin>>n;
for(int i=1;i<=n;i++)
{
cin>>h[i].x>>h[i].y;
}
int z=0;
for(int i=1;i<=n;i++)
{
for(int j=1;j<=n;j++)
{
if(i==j)
{
continue;
}
if(h[i].y==h[j].y)
{
z++;
}
}
}
cout<<z/2;
return 0;
}