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.
#	Author	: debugster
#	Email	: [email protected]
#	Date	: 2020-07-23 20:31:20

import sys
import os

def get_int():
    return map(int, input().split())

def get_array():
    return list(map(int, input().split()))

def array_1D(length, value = 0):
    data = [value for _ in range(length)]
    return data

def array_2D(row, col, value = 0):
    data = [[value for c in range(col)] for r in range(row)]
    return data

def vector_2D(nodes):
    data = dict()
    for n in range(nodes):
        data[n] = list()
    
    return data

def str_replacer(old_str, new_str, index):
    if index in range(len(old_str)):
        return old_str[:index] + new_str + old_str[index + 1:]
    else:
        return old_str

if os.environ.get("DEBUGSTER_PYTHON"):
    sys.stdin = open('in.txt', 'r')
    sys.stdout = open('out.txt','w')

n = int(input())
ans = 0
for _ in range(n):
    a, b = get_int()
    if a == b:
        ans += 1
print(ans)
