output_description: Print the number of boxes that may contain the red ball after all operations
  are performed.
  
  * * *
input_description: The input is given from Standard Input in the following format:
  
      
      
      N M
      x_1 y_1
      :
      x_M y_M
attempt: n, m = map(int, input().split())
  a = [[int(i) for i in input().split()] for i in range(m)]
  p = ["f"] * n
  p[0] = "t"
  q = [1] * n
  for i in range(0, m):
      if p[a[i][0] - 1] == "t":
          p[a[i][1] - 1] = "t"
          q[a[i][0] - 1] -= 1
          q[a[i][1] - 1] += 1
          if q[a[i][0] - 1] == 0:
              p[a[i][0] - 1] = "f"
  print(p.count("t"))
  
problem_description: Statement
  
  We have N boxes, numbered 1 through N. At first, box 1 contains one red ball,
  and each of the other boxes contains one white ball.
  
  Snuke will perform the following M operations, one by one. In the i-th
  operation, he randomly picks one ball from box x_i, then he puts it into box
  y_i.
  
  Find the number of boxes that may contain the red ball after all operations
  are performed.
samples: [{"input": "3 2\n    1 2\n    2 3", "output": "2\n    \n\nJust after the first operation, box 1 is empty, box 2 contains one red ball\nand one white ball, and box 3 contains one white ball.\n\nNow, consider the second operation. If Snuke picks the red ball from box 2,\nthe red ball will go into box 3. If he picks the white ball instead, the red\nball will stay in box 2. Thus, the number of boxes that may contain the red\nball after all operations, is 2.\n\n* * *"}, {"input": "3 3\n    1 2\n    2 3\n    2 3", "output": "1\n    \n\nAll balls will go into box 3.\n\n* * *"}, {"input": "4 4\n    1 2\n    2 3\n    4 1\n    3 4", "output": "3"}]