#K69817. Trains at a Station

    ID: 33171 Type: Default 1000ms 256MiB

Trains at a Station

Trains at a Station

You are given a list of events at a train station. Each event consists of a time and a type, where the type is either arrive or depart. When a train arrives, the count of trains at the station increases by one, and when a train departs, the count decreases by one.

Your task is to determine the maximum number of trains present at the station at any given time.

Note: The events may not be sorted by time, and there can be multiple events at the same time. If an arrival and departure share the same timestamp, the arrival is processed before the departure.

The answer should be computed according to the formula:

$$\text{max\_trains} = \max_{1 \leq i \leq n}\{\text{count}(i)\}$$

where count(i) is the number of trains at the station after processing the i-th event.

inputFormat

The first line contains an integer n representing the number of events.

The next n lines each contain an integer and a string separated by a space. The integer represents the time of the event, and the string is either arrive or depart.

For example:

8
2 arrive
3 arrive
5 arrive
5 depart
7 arrive
9 depart
10 depart
12 depart

outputFormat

Output a single integer representing the maximum number of trains at the station at any moment.

For the above example, the output should be:

3
## sample
1
0 arrive
1

</p>