import java.util.Collections;
import java.util.LinkedList;

import java.util.Scanner;

public class Z3tak {

    public static void main(String[] args) {
        int n;
        Scanner input = new Scanner(System.in);
        n = input.nextInt();

        LinkedList<Integer> kolona = new LinkedList<Integer>();
        LinkedList<Integer> red = new LinkedList<Integer>();

        for (int i = 0; i < n; i++) {
            int a = input.nextInt();
            int b = input.nextInt();
            kolona.add(a);
            red.add(b);

        }
        int brojac1 = 0;
        int brojac2 = 0;
        int rez = 0;

        Collections.sort(kolona);
        Collections.sort(red);

        for (int i = 0; i < n; i++) {
            //  System.out.println("\ni = " + i + " vr i: " + kolona.get(i));

            for (int j = i + 1; j < n; j++) {

                if (kolona.get(i).equals(kolona.get(j))) {
                    for (int k : kolona) {
                        brojac1 = Collections.frequency(kolona, k) - 1;

                    }
                }

            }
        }

        for (int i = 0; i < n; i++) {
            for (int j = i + 1; j < n; j++) {

                if (red.get(i).equals(red.get(j))) {

                    for (int k : kolona) {
                        brojac2 = Collections.frequency(red, k) - 1;
                       

                    }
                }
            }
        }

        System.out.println(brojac1 + brojac2);

    }
}