Sereja and his friends went to a picnic. The guys had *n* soda bottles just for it. Sereja forgot the bottle opener as usual, so the guys had to come up with another way to open bottles.

Sereja knows that the *i*-th bottle is from brand *a*<sub class="lower-index">*i*</sub>, besides, you can use it to open other bottles of brand *b*<sub class="lower-index">*i*</sub>. You can use one bottle to open multiple other bottles. Sereja can open bottle with opened bottle or closed bottle.

Knowing this, Sereja wants to find out the number of bottles they've got that they won't be able to open in any way. Help him and find this number.
The first line contains integer *n* (1 ≤ *n* ≤ 100) — the number of bottles. The next *n* lines contain the bottles' description. The *i*-th line contains two integers *a*<sub class="lower-index">*i*</sub>, *b*<sub class="lower-index">*i*</sub> (1 ≤ *a*<sub class="lower-index">*i*</sub>, *b*<sub class="lower-index">*i*</sub> ≤ 1000) — the description of the *i*-th bottle.
from sys import stdin
input = stdin.readline
from heapq import heapify,heappush,heappop,heappushpop
from collections import defaultdict as dd, deque as dq,Counter as C
from math import factorial as f ,ceil,gcd,sqrt,log
from bisect import bisect_left as bl ,bisect_right as br
from itertools import combinations as c,permutations as p
from math import factorial as f ,ceil,gcd,sqrt,log
mi = lambda : map(int,input().split())
ii = lambda: int(input())
li = lambda : list(map(int,input().split()))
mati = lambda  r : [ li() for _ in range(r)]
lcm = lambda a,b : (a*b)//gcd(a,b) 




def solve():
    n=ii()
    arr1=[]
    arr2=[]
    for x in range(n):
        a,b=mi()
        arr1.append(a)
        arr2.append(b)
    ans=0
    for x in range(len(arr1)):
        if arr1[x] not in arr2[:x] and arr1[x] not in arr2[x+1:]:
            ans+=1
    print(ans)
for _ in range(1):
    solve()