A company has
Count how many offices can receive the alert, including the starting office.
The first line contains three integers KaTeX can only parse string typed expression, KaTeX can only parse string typed expression, and KaTeX can only parse string typed expression — the number of offices, channels, and the starting office.
Each of the next KaTeX can only parse string typed expression lines contains two integers KaTeX can only parse string typed expression and KaTeX can only parse string typed expression, meaning an alert can move from office KaTeX can only parse string typed expression to office KaTeX can only parse string typed expression.
Print a single integer — the number of offices that can receive the alert.
Input
6 4 1
1 2
2 3
3 4
5 6Output4ExplanationFrom office KaTeX can only parse string typed expression, the alert can reach KaTeX can only parse string typed expression.
Example 2:
Input
5 3 3
1 2
2 1
4 5Output1ExplanationNo outgoing channel starts from office KaTeX can only parse string typed expression, so only office KaTeX can only parse string typed expression receives the alert.