Question
Office Message Relay

A company has N offices. Some offices can send internal alerts to other offices through one-way communication channels. An urgent alert starts from office S.

Count how many offices can receive the alert, including the starting office.


 

Input

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.

Output

Print a single integer — the number of offices that can receive the alert.

Example
Example 1:
Input
6 4 1

1 2
2 3
3 4
5 6
Output
4
Explanation
From 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 5
Output
1
Explanation
No 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.

Online