A company has n offices, numbered 1 to n, connected by a one-way phone tree: m directed links, where a link u v means office u can call office v directly (but not necessarily the reverse). An emergency alert starts at headquarters, office s, and propagates along the directed links: any office that receives the alert immediately relays it to every office it has a direct link to.
Report how many of the n offices NEVER receive the alert (office s itself always receives it, so it never counts as unreached).
Input format
Line 1: two integers n and m — number of offices (1-indexed) and number of links.
Next m lines: two integers u v — a directed link from office u to office v.
Last line: one integer s — the headquarters office.
Output format
A single integer: the number of offices that never receive the alert.
Constraints
- 1 ≤ n ≤ 40
- 0 ≤ m ≤ 200
- 1 ≤ u, v, s ≤ n