Codeforces Round 187 (Div. 2)
A
Sereja and Bottles
Codeforces
1400
原题
←B →
翻译中…

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*_{*i*}$, besides, you can use it to open other bottles of brand $*b*_{*i*}$. 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.

翻译中…

Input

翻译中…

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*_{*i*}, *b*_{*i*}$ $(1 ≤ *a*_{*i*}, *b*_{*i*} ≤ 1000)$ — the description of the $*i*$-th bottle.

翻译中…

Output

翻译中…

In a single line print a single integer — the answer to the problem.

翻译中…

样例

Input #1
4
1 1
2 2
3 3
4 4
Output #1
4
InputCopy OutputCopy
Input #2
4
1 2
2 3
3 4
4 1
Output #2
0
InputCopy OutputCopy
题目信息
题号
315A
时间限制
2 s
内存限制
256 MB
标签
暴力

题面与样例版权归 Codeforces 及出题人所有;中文翻译由 AI 生成(CI 管线),如有出入请以原文为准。