import java.util.Scanner; class Main{ public static void main(String[] args){ Scanner sc = new Scanner(System.in); int N = sc.nextInt(); int M = sc.nextInt(); boolean[] ind = new boolean[N+1]; int ans = N; while(M-->0){ sc.next(); int B = sc.nextInt(); if(!ind[B]){ ind[B] = true; --ans; } } System.out.println(ans); } }