CF315A.Sereja and Bottles

普及/提高-

通过率:0%

AC君温馨提醒

该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。

题目描述

Sereja and his friends went to a picnic. The guys had nn 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 ii -th bottle is from brand aia_{i} , besides, you can use it to open other bottles of brand bib_{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.

输入格式

The first line contains integer nn (1<=n<=100)(1<=n<=100) — the number of bottles. The next nn lines contain the bottles' description. The ii -th line contains two integers ai,bia_{i},b_{i} (1<=ai,bi<=1000)(1<=a_{i},b_{i}<=1000) — the description of the ii -th bottle.

输出格式

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

输入输出样例

  • 输入#1

    4
    1 1
    2 2
    3 3
    4 4
    

    输出#1

    4
    
  • 输入#2

    4
    1 2
    2 3
    3 4
    4 1
    

    输出#2

    0
    
首页