using System;

namespace Prepisivaci
{
    class Program
    {
        static void Main(string[] args)
        {
            int n = int.Parse(Console.ReadLine());
            int[] x = new int[n];
            int[] y = new int[n];
            for (int i = 0; i < n; i++)
            {
                string[] s = Console.ReadLine().Split();
                x[i] = int.Parse(s[0]);
                y[i] = int.Parse(s[1]);
            }
            int c = 0;
            for (int i = 0; i < n-1; i++)
            {
                int raz = x[i] - y[i];
                for (int j = i+1; j < n; j++)
                {
                    int raz1 = x[j] - y[j];
                    if (raz * 2 == raz1 && (x[i] + y[i]) != (x[j] + y[j]))
                    {
                        c++;
                    }
                }
            }
            
            Console.WriteLine(c);
        }
    }
}