// CPP Program to find sum of Manhattan distance
// between all the pairs of given points
#include <iostream>
using namespace std;
#include <cmath>


// Driven Program
int main()
{
    int n; cin>>n;
    int kontrolor = 0;
    int x[6];
    int y[6];
    for(int i= 0; i<n; i++)
        cin>>x[i]>>y[i];


    int max = 0;
    double distance[100];
    for (int i = 0; i < n; i++)
        for (int j = i + 1; j < n; j++){
            distance[max] = (abs(x[i] - x[j]) +abs(y[i] - y[j]));
            max++;
        }

    for(int i = 0 ; i<n; i++){
        for(int j=i+1; j<n; j++){
            if((distance[i] * 2 == distance[j]) || (distance[j] * 2 == distance[i]) ){
                kontrolor++;
            }
        }
    }
        
    
        
    cout<<kontrolor;
        
        
    return 0;
}