#include int main(void) { long long N, M, A, B; scanf("%ld %ld", &N, &M); long long *deg = (long long *)calloc(N, sizeof(long long)); for (long long i = 0; i < M; ++i) { scanf("%ld %ld", &A, &B); deg[B - 1]++; } long long ans = 0; for (int i = 0; i < M; ++i) { if (deg[i] == 0) ans++; } printf("%ld\n", ans); free(deg); return 0; }