4981. It takes two

单点时限: 1.0 sec

内存限制: 256 MB

lbrominewanted to play It Takes Two, but it takes two. So he went to his friends and asked them if they had played It Takes Two.

It is known thatlbrominehas $n$ friends. When he asks a friend, the friend will only answer that he has not played or played It Takes Two with another person.Because some of his friends are forgetful,maybe some friends have played It Takes Two but say no.

lbrominethinks that a friend has played It Takes Two only when the friend said he had played with another person or another friend oflbrominesaid he had played with him.

Nowlbrominewants to count how many friends he thinks have never played It Takes Two so that he can choose the right person to play with.

输入格式

An integer $n$ in the first line indicates thatlbrominehas $n\ (1 \leq n\leq 10^5)$ friends.

The next $n$ line has two strings per line. The first string represents the friend’s name, and the second string represents the answer of the friend.

It is guaranteed that the answer oflbromine'sfriends can only be No or a person’s name (may not be a friend oflbromine).

A person’s name only contains uppercase and lowercase letters and underscores,and the length cannot exceed $10$ characters.

no one names No.

输出格式

One integer indicates how many friendslbrominethinks have never played It Takes Two

样例

Input
3
CN_Amuzi No
komorebi MaverickFW
MaverickFW No
Output
1

649 人解决,875 人已尝试。

739 份提交通过,共有 2726 份提交。

2.1 EMB 奖励。

创建: 1 年,10 月前.

修改: 1 年,9 月前.

最后提交: 2 月前.

来源: 2023 年上海市大学生程序设计竞赛 - 一月赛

题目标签