import java.util.Scanner;

public class Archery {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int[][] pole = new int[a][2];
        sc.nextLine();
        for (int i = 0; i < a; i++) {
            int p = sc.nextInt();
            int q = sc.nextInt();
            pole[p-1][0] = pole[p-1][0] + 1;
            pole[q-1][1] = pole[q-1][1] + 1;
        }
        int pocet = 0;
        for (int i = 0; i < a; i++) {
            if (pole[i][0] == 0) {
                pocet++;

            }
            if (pole[i][1] == 0) {
                pocet++;
            }

        }
        System.out.println(pocet);
    }
}
