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

L = list(list(map(int,input().split())) for i in range(M))



A = [1 for i in range(N+1)]



red = [0 for i in range(N+1)]

red[1] = 1



ans = 1

for i in range(M) :

    A[L[i][0]] -= 1

    A[L[i][1]] += 1

    if red[L[i][0]] == 1 :

        red[L[i][1]] = 1

    if A[L[i][0]] == 0 :

        red[L[i][0]] = 0

        

ans = sum(red)

print(ans)

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



L = [1 for i in range(N)]



R = [0 for i in range(N)]

R[0] = 1



for i in range(M) :

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

    x -= 1

    y -= 1

    

    L[x] -= 1

    L[y] += 1

    

    if R[x] == 1 and R[y] == 0 :

        R[y] = 1

    

    if L[x] == 0 and R[x] == 1 :

        R[x] = 0

    



print((sum(R)))

    
N, M = list(map(int, input().split()))
L = list(list(map(int, input().split())) for i in range(M))
A = [1 for i in range(N + 1)]
red = [0 for i in range(N + 1)]
red[1] = 1
ans = 1
for i in range(M):
    A[L[i][0]] -= 1
    A[L[i][1]] += 1
    if red[L[i][0]] == 1:
        red[L[i][1]] = 1
    if A[L[i][0]] == 0:
        red[L[i][0]] = 0
ans = sum(red)
print(ans)

N, M = list(map(int, input().split()))
L = [1 for i in range(N)]
R = [0 for i in range(N)]
R[0] = 1
for i in range(M):
    x, y = list(map(int, input().split()))
    x -= 1
    y -= 1
    L[x] -= 1
    L[y] += 1
    if R[x] == 1 and R[y] == 0:
        R[y] = 1
    if L[x] == 0 and R[x] == 1:
        R[x] = 0
print((sum(R)))

-L = list(list(map(int, input().split())) for i in range(M)) -A = [1 for i in range(N + 1)] -red = [0 for i in range(N + 1)] -red[1] = 1 -ans = 1 +L = [1 for i in range(N)] +R = [0 for i in range(N)] +R[0] = 1 -    A[L[i][0]] -= 1 -    A[L[i][1]] += 1 -    if red[L[i][0]] == 1: -        red[L[i][1]] = 1 -    if A[L[i][0]] == 0: -        red[L[i][0]] = 0 -ans = sum(red) -print(ans) +    x, y = list(map(int, input().split())) +    x -= 1 +    y -= 1 +    L[x] -= 1 +    L[y] += 1 +    if R[x] == 1 and R[y] == 0: +        R[y] = 1 +    if L[x] == 0 and R[x] == 1: +        R[x] = 0 +print((sum(R)))