n,m=list(map(int,input().split()))

b=[1]*n

red=[False]*n

red[0]=True

for i in range(m):

  x,y=list(map(int,input().split()))

  x,y=x-1,y-1

  if not b[x]:

    continue

  b[y]+=1

  if red[x]:

    red[y]=True

  

  b[x]-=1

  if b[x]==0:

    red[x]=False

    

print((red.count(True)))

import sys

readline = sys.stdin.readline



N,M = list(map(int,readline().split()))

B = [1] * N

possible = {0}

for i in range(M):

  x,y = list(map(int,readline().split()))

  x,y = x - 1,y - 1

  B[x] -= 1

  B[y] += 1

  if x in possible:

    possible.add(y)

  if x in possible and B[x] == 0:

    possible.remove(x)



print((len(possible)))
n, m = list(map(int, input().split()))
b = [1] * n
red = [False] * n
red[0] = True
for i in range(m):
    x, y = list(map(int, input().split()))
    x, y = x - 1, y - 1
    if not b[x]:
        continue
    b[y] += 1
    if red[x]:
        red[y] = True
    b[x] -= 1
    if b[x] == 0:
        red[x] = False
print((red.count(True)))

import sys

readline = sys.stdin.readline
N, M = list(map(int, readline().split()))
B = [1] * N
possible = {0}
for i in range(M):
    x, y = list(map(int, readline().split()))
    x, y = x - 1, y - 1
    B[x] -= 1
    B[y] += 1
    if x in possible:
        possible.add(y)
    if x in possible and B[x] == 0:
        possible.remove(x)
print((len(possible)))

-n, m = list(map(int, input().split())) -b = [1] * n -red = [False] * n -red[0] = True -for i in range(m): -    x, y = list(map(int, input().split())) +import sys + +readline = sys.stdin.readline +N, M = list(map(int, readline().split())) +B = [1] * N +possible = {0} +for i in range(M): +    x, y = list(map(int, readline().split())) -    if not b[x]: -        continue -    b[y] += 1 -    if red[x]: -        red[y] = True -    b[x] -= 1 -    if b[x] == 0: -        red[x] = False -print((red.count(True))) +    B[x] -= 1 +    B[y] += 1 +    if x in possible: +        possible.add(y) +    if x in possible and B[x] == 0: +        possible.remove(x) +print((len(possible)))