from collections import defaultdict

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

v = [0]*n

v[0]=1

ans = [1]*n

fi = 1

for i in range(m):

    a,b=list(map(int, input().split()))

    ans[a-1]-=1

    ans[b-1]+=1

    if v[a-1]:

        v[b-1]=1

        fi+=1

    if ans[a-1]==0:

        v[a-1]=0

        fi-=1



print((sum(v)))

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

aka = [0]*(n+1)

siroaka = [1]*(n+1)

aka[1] = 1

for i in range(m):

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

    siroaka[x]-=1

    siroaka[y]+=1

    if(aka[x]):

        aka[y]=1

    if(siroaka[x]==0):

        aka[x]=0



print((sum(aka)))

from collections import defaultdict

n, m = list(map(int, input().split()))
v = [0] * n
v[0] = 1
ans = [1] * n
fi = 1
for i in range(m):
    a, b = list(map(int, input().split()))
    ans[a - 1] -= 1
    ans[b - 1] += 1
    if v[a - 1]:
        v[b - 1] = 1
        fi += 1
    if ans[a - 1] == 0:
        v[a - 1] = 0
        fi -= 1
print((sum(v)))

n, m = list(map(int, input().split()))
aka = [0] * (n + 1)
siroaka = [1] * (n + 1)
aka[1] = 1
for i in range(m):
    x, y = list(map(int, input().split()))
    siroaka[x] -= 1
    siroaka[y] += 1
    if aka[x]:
        aka[y] = 1
    if siroaka[x] == 0:
        aka[x] = 0
print((sum(aka)))

-from collections import defaultdict - -v = [0] * n -v[0] = 1 -ans = [1] * n -fi = 1 +aka = [0] * (n + 1) +siroaka = [1] * (n + 1) +aka[1] = 1 -    a, b = list(map(int, input().split())) -    ans[a - 1] -= 1 -    ans[b - 1] += 1 -    if v[a - 1]: -        v[b - 1] = 1 -        fi += 1 -    if ans[a - 1] == 0: -        v[a - 1] = 0 -        fi -= 1 -print((sum(v))) +    x, y = list(map(int, input().split())) +    siroaka[x] -= 1 +    siroaka[y] += 1 +    if aka[x]: +        aka[y] = 1 +    if siroaka[x] == 0: +        aka[x] = 0 +print((sum(aka)))