#include <iostream>
#include <vector>
using namespace std;

int main()
{
    int n,br=0;
    cin>>n;
    vector<int> x(n);
    vector<int> y(n);
    for(int i=0;i<n;i++)
    {
        cin>>x[i]>>y[i];
    }

    for(int i=0;i<n;i++)
    {
        for(int j=i+1;j<n;j++)
        {
            for(int q=j+1;q<n;q++)
            {
                for(int w=q+1;w<n;w++)
                {
                    if(abs(x[i]-x[j]) == abs(x[q]-x[w]) || abs(y[i]-y[j]) == abs(y[q]-y[w]))
                        br++;
                    if(abs(x[i]-x[j]) - abs(x[q]-x[w]) == abs(y[i]-y[j])- abs(y[q]-y[w]))
                        br++;
                }
            }
        }
    }
    cout<<br;
    return 0;
}