import java.util.Scanner;


public class Nesusedni {

   
    public static void main(String[] args) {
int N,i,j,x1,x2,y1,y2,AB=0,DC=0,brojac=0;
Scanner in=new Scanner(System.in);
N=in.nextInt();
if(N<1 || N>1500){
        System.exit(1);
    }
int x[]=new int[N];
int y[]=new int[N];
for(i=0;i<N;i++){
    x[i]=in.nextInt();
    y[i]=in.nextInt();
}
{
    for(i=0;i<N;i++){
     
        for(j=1;j<N;j++){
            if(y[i]==y[j] || x[i]==x[j]){
                if(AB==0){
                    
                    x1=x[i];
                    x2=x[j];
                   
                    y1=y[i];
                    y2=y[j];
                    AB=(int) Math.sqrt((y1-y2)*(y1-y2)+(x1-x2)*(x1-x2));
                   
                }
                else if(DC==0){
                 
                    x1=x[i];
                    x2=x[j];
                    
                    y1=y[i];
                    y2=y[j];
                    DC=(int) Math.sqrt((y1-y2)*(y1-y2)+(x1-x2)*(x1-x2));
                    
                }
                if(AB!=0 && DC!=0){
                    
                    if(AB*2==DC){
                        brojac++;
                        AB=0;
                        DC=0;
                    }
                    else if(DC*2==AB){
                       
                        brojac++;
                         AB=0;
                        DC=0;
                    }
                    else if(AB>DC || AB==DC){
                        DC=0;
                    }
                    else if(AB<DC)
                        AB=0;
                }
            }
        }
    }
    System.out.println(brojac);
}

    }
}