Олимпиадный тренинг

Задача 38835. 3 cows


Задача

Темы: Словари
Sklises — "marsupial artiodactyls" in the form of a cow with membranous wings from the planet Sheshineru. Despite the ability to fly, the Skliss, like any terrestrial cow, is quite lazy and slow-witted (read more about skliss). 
Professor Igor Seleznev took on board three sklisses for study: Bessie (Bessie), Elsie (Elsie) and Mildred (Mildred), each of which initially produces 7 gallons of milk per day. Since it is known that the yield of the skliss may change over time, Professor Seleznev takes periodic measurements over the next 100 days and writes them down in a log. The entries in his journal look like this:

35 Bessie-2
14 Mildred +3


The first entry indicates that on Day 35, Bessie's milk yield was 2 gallons lower than at the last measurement. The following entry indicates that on day 14, Mildred's milk production increased by 3 gallons compared to when it was last measured.
Professor Seleznev is busy with many studies, so he can take no more than one measurement per day. Unfortunately, he does not always have time to record everything in a log at once and, therefore, his measurements may not be in chronological order.

To keep the Skliss motivated, Igor Seleznev proudly hangs a photo of the Skliss with the highest milk yield on the wall of the organized farm (if there are several such Skliss, he posts all their photos).
Determine the number of days during which Professor Igor Seleznev would need to change his photo.

Input
The first line of input contains N, the number of measurements the professor took. Each of the following N lines describes a single measurement, in the format described above: a day (an integer from 1 to 100), a Skliss name, and a performance change (a non-zero integer). The amount of milk that any skliss gives will always be in the range 0..1000.

Imprint
Print e number of days during which Professor Igor Seleznev would need to change his photo.
 
Examples
# Input Output Explanation
1
4
7 Mildred +3
4 Elsie-1
9 Mildred-1
1 Bessie +2
3
Initially, all Sklisses yield 7. On Day 1, Bessie's performance will rise to 9, making her the only winner and forcing the Professor to change her photo. On day 4, Elsie's performance will drop to 6, but that won't change the fact that Bassie will remain the leader. On day 7, Mildred will take the lead, on day 8, Mildred will be level with Bessie, which will again lead to a change of cards.