A build system has n jobs. A directed edge u v means job v depends on job u, so v cannot begin until u has finished. A job with no incoming dependency edges can be started right away. A self-loop u u counts as an incoming edge, so a job with a self-loop cannot start immediately. Count how many jobs can be started immediately.
Input format
Line 1: two integers n and m — the number of nodes (labeled 0 through n-1) and the number of directed edges.
Each of the next m lines: two integers u v, a directed edge from to (read as: must come before ).
Output format
A single integer: the number of jobs with no incoming edges.
Constraints
- 1 <= n <= 100000
- 0 <= m <= 200000
- 0 <= u, v <= n-1 (self-loops and repeated edges may appear)