#include <bits/stdc++.h>

using namespace std;
int N,K[100000010];
int br=0;
int main(){
   cin>>N;
   for (int i=1;i<=N*2;i++){
      cin>>K[i];
   }
   for (int j=1;j<=N;j++){
      for (int p=1;p<=N;p++){
         if (K[j]>=0 and K[p]>=0 or K[j]<0 and K[p]<0){
            if (K[j+2]==K[p+2]) br++;
            else if (sqrt(K[j]+K[j+2])*2==sqrt(K[p]+K[p+2])) br++;
         }
         else if (K[j]>=0 and K[p]<0 or K[j]<0 and K[p]>=0){
                 if (K[j+2]==K[p+2]) br++;
                 else if (sqrt(K[j]+K[j+2])*2==sqrt(K[p]+K[p+2])) br++;
              }
      }
   }
   cout<<br/N<<endl;
   return 0;
}