Under construction

Still being built. Things may change

Friendly Chongchong

Interview

Time limit1sMemory limit1024 MB

Summary
Given N meeting records in order, count how many people are dancing the rainbow dance after the last record, starting from ChongChong alone.
Level

Easy3 of 10

Topics
Hash map, Simulation
Solved
No attempts yet

Problem

Chongchong doing the rainbow dance while another Chongchong watches

Chongchong got a chance to appear at the 2nd Gomgom Cup through his friend Gomgom!

Chongchong wants to win over the audience by showing off his special trick, the rainbow dance. The dance is so addictive that everyone who sees it ends up copying it.

Two Chongchongs doing the rainbow dance

NN records of people meeting each other are given in chronological order. (Chongchong is a rabbit, but for this problem, we assume he is a person.)

When a person who is not dancing the rainbow dance meets a person who is dancing it, the first person starts dancing it from the time of the meeting.

Before the records begin, Chongchong is the only one dancing the rainbow dance. Find how many people are dancing the rainbow dance after the last record!

Input

The first line contains the number of records N (1≤N≤1 000)N\ (1 \le N \le 1\ 000). The next NN lines each contain one record. Line i+1i + 1 contains the names A_iA\_i and B_iB\_i of the two people in the ii-th meeting, separated by a space. A_iA\_i and B_iB\_i are strings of digits and English letters, up to 20 characters long, and they are different from each other.

Chongchong's name is ChongChong, and it appears in the records at least once. No two people share a name, and names are case-sensitive. (ChongChong and chongchong are different names.)

Output

Print the number of people dancing the rainbow dance after the last record.

Examples1

  1. Example 1

    Input
    12
    bnb2011 chansol
    chansol chogahui05
    chogahui05 jthis
    jthis ChongChong
    jthis jyheo98
    jyheo98 lms0806
    lms0806 pichulia
    pichulia pjshwa
    pjshwa r4pidstart
    r4pidstart swoon
    swoon tony9402
    tony9402 bnb2011
    
    Expected output
    10