Under construction

Still being built. Things may change

Late Students

Time limit1sMemory limit1024 MB

Summary
Count the students who arrive at or after the start time and not before the teacher, since they are caught and must clean the classroom.
Level

Easy1 of 10

Topics
Simulation, Implementation
Solved
No attempts yet

Problem

The NN students of class 2-4 at Sunrin High School are often late.

A student is late if they do not arrive before the set start time. However, if a student enters the classroom before the teacher, the teacher does not find out about the lateness. Students whose lateness is discovered must clean the classroom as punishment.

Given the times the teacher and students entered the classroom, find how many students will clean the classroom today.

Input

The first line contains the total number of students NN.

From the second line, each of the next N+1N+1 lines contains the time AiA_i a person entered the classroom, including the teacher, followed by a space and whether that person is a student. Times are in the HH:MM format. (1≤i≤N+11\le i\le N+1; 0≤0\le HH ≤23\le 23; 0≤0\le MM ≤59\le 59)

Line N+3N+3 contains the set start time.

All given times are between 06:00 and 18:00.

Whether the person is a student is given as the string student or teacher.

There is always exactly one teacher.

Output

Print the number of students who will clean the classroom today.

Arriving exactly at the set start time counts as late, so a late student is caught even if they arrive at the same time as the teacher.

Constraints

1≤N≤10001\le N\le 1000

Examples1

  1. Example 1

    Input
    5
    15:52 student
    08:18 student
    13:12 student
    16:12 student
    15:52 teacher
    13:47 student
    09:18
    
    Expected output
    2