using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace petlja2
{
    class Program
    {
        static void Main(string[] args)
        {
            int n = int.Parse(Console.ReadLine());
            int[,] tabla = new int[n+1, n+1];
            string[] x;
            int br = 0;
            for (int i = 0; i < n; i++)
            {
                x = Console.ReadLine().Split();
                tabla[int.Parse(x[0]), int.Parse(x[1])] = 1;
            }
            for (int i = 1; i < n+1; i++)
            {
                for (int j = 1; j < n+1; j++)
                {
                    if (tabla[i, j] == 1)
                        tabla[i, 0]++;
                }
                if (tabla[i, 0] > 1)
                    br += tabla[i, 0] - 1;
            }
            for (int i = 1; i < n + 1; i++)
            {
                for (int j = 1; j < n + 1; j++)
                {
                    if (tabla[j, i] == 1)
                        tabla[0, i]++;
                }
                if (tabla[0, i] > 1)
                    br += tabla[0, i] - 1;
            }
            Console.WriteLine(br);

        }
    }
}