




import math
from decimal import Decimal, getcontext




def        __SCREAMING_SNAKE_CASE (	lowercase_ = 4_00_00_00   )							->						int:

    """simple docstring"""


    try:
        __UpperCamelCase			=    int(lowercase_   )
    except (TypeError, ValueError):
        raise TypeError('''Parameter n must be int or castable to int.'''   )
    if n <= 0:
        raise ValueError('''Parameter n must be greater than or equal to one.'''   )
    __UpperCamelCase			=    1_00
    __UpperCamelCase			=    (Decimal(5   ) ** Decimal(0.5   ) + 1) / Decimal(2   )

    __UpperCamelCase			=    (math.floor(math.log(n * (phi + 2)       ,  lowercase_   ) - 1   ) // 3) * 3 + 2
    __UpperCamelCase			=    Decimal(round(phi ** Decimal(index + 1   )   )   ) / (phi + 2)
    __UpperCamelCase			=    num // 2
    return int(lowercase_   )


if __name__ == "__main__":
 print(f"""{solution() = }""")







'''simple docstring'''




from __future__ import annotations




def 				lowerCamelCase      ( UpperCAmelCase__			:   str					)     -> Any:
							global graph, reversed_graph, scc, component, visit, stack
							if visit[u]:
														return
							lowercase_   :     int									=			True
							for v in graph[u]:
														dfs(UpperCAmelCase__					)
							stack.append(UpperCAmelCase__					)




def 				lowerCamelCase      ( UpperCAmelCase__			:   int					)     -> str:
							global graph, reversed_graph, scc, component, visit, stack
							if visit[u]:
														return
							lowercase_   :     Tuple									=			True
							component.append(UpperCAmelCase__					)
							for v in reversed_graph[u]:
														dfsa(UpperCAmelCase__					)




def 				lowerCamelCase      ( )     -> int:
							global graph, reversed_graph, scc, component, visit, stack
							for i in range(UpperCAmelCase__					):
														dfs(UpperCAmelCase__					)
							lowercase_   :     Optional[int]									=			[False] * n
							for i in stack[::-1]:
														if visit[i]:
																					continue
														lowercase_   :     Union[str, Any]									=			[]
														dfsa(UpperCAmelCase__					)
														scc.append(UpperCAmelCase__					)
							return scc


if __name__ == "__main__":
						# n - no of nodes, m - no of edges
						_lowercase							,			_lowercase		:					Optional[Any]													=		list(map(int, input().strip().split()))

						_lowercase		:					list[list[int]]													=		[[] for _ in range(n)]  # graph
						_lowercase		:					list[list[int]]													=		[[] for i in range(n)]  # reversed graph
						# input graph data (edges)
						for _ in range(m):
												_lowercase							,			_lowercase		:					Tuple													=		list(map(int, input().strip().split()))
												graph[u].append(v)
												reversed_graph[v].append(u)

						_lowercase		:					list[int]													=		[]
						_lowercase		:					list[bool]													=		[False] * n
						_lowercase		:					list[int]													=		[]
						_lowercase		:					list[int]													=		[]
						print(kosaraju())





