from __future__ import annotations





def  lowercase(  UpperCamelCase_					)		->  set[int]:







 '''simple docstring'''
 UpperCamelCase      =			{1}
 UpperCamelCase      =			[1]
 for _ in range(2       ,				depth + 1					):
  UpperCamelCase      =			[*previous_coefficients, 0]
  UpperCamelCase      =			[0, *previous_coefficients]
  UpperCamelCase      =			[]
  for x, y in zip(UpperCamelCase_       ,				UpperCamelCase_					):
   coefficients.add(x + y					)
   previous_coefficients.append(x + y					)
 return coefficients





def  lowercase(  UpperCamelCase_					)		->  set[int]:







 '''simple docstring'''
 UpperCamelCase      =			set()
 for number in unique_coefficients:
  UpperCamelCase      =			2
  UpperCamelCase      =			number
  while divisor**2 <= copy_number:
   UpperCamelCase      =			0
   while copy_number % divisor == 0:
    copy_number //= divisor
    multiplicity += 1
   if multiplicity >= 2:
    non_squarefrees.add(UpperCamelCase_					)
    break
   divisor += 1

 return unique_coefficients.difference(UpperCamelCase_					)





def  lowercase(  UpperCamelCase_ = 51					)		->  int:







 '''simple docstring'''
 UpperCamelCase      =			get_pascal_triangle_unique_coefficients(UpperCamelCase_					)
 UpperCamelCase      =			get_squarefrees(UpperCamelCase_					)
 return sum(UpperCamelCase_					)


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

from __future__ import annotations





def  lowercase(  UpperCamelCase_					)		->  Dict:







 '''simple docstring'''
 global graph, reversed_graph, scc, component, visit, stack
 if visit[u]:
  return
 UpperCamelCase      =			True
 for v in graph[u]:
  dfs(UpperCamelCase_					)
 stack.append(UpperCamelCase_					)





def  lowercase(  UpperCamelCase_					)		->  Optional[int]:







 '''simple docstring'''
 global graph, reversed_graph, scc, component, visit, stack
 if visit[u]:
  return
 UpperCamelCase      =			True
 component.append(UpperCamelCase_					)
 for v in reversed_graph[u]:
  dfsa(UpperCamelCase_					)





def  lowercase(  )		->  Any:







 '''simple docstring'''
 global graph, reversed_graph, scc, component, visit, stack
 for i in range(UpperCamelCase_					):
  dfs(UpperCamelCase_					)
 UpperCamelCase      =			[False] * n
 for i in stack[::-1]:
  if visit[i]:
   continue
  UpperCamelCase      =			[]
  dfsa(UpperCamelCase_					)
  scc.append(UpperCamelCase_					)
 return scc


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

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

     _SCREAMING_SNAKE_CASE   		=			[]
     _SCREAMING_SNAKE_CASE   		=			[False] * n
     _SCREAMING_SNAKE_CASE   		=			[]
     _SCREAMING_SNAKE_CASE   		=			[]
     print(kosaraju())
