Woburn Challenge 2017-18 Round 4 - Junior Division
Bruce Banner is a scientist with a bit of a problem. Whenever he becomes too angry, he transforms into a large green creature with superhuman strength, known as the Hulk! This can be very useful when he's helping the Avengers battle against the forces of evil, but isn't so useful in his daily life.
Natasha Romanova, the Black Widow, has become concerned that Bruce may be undergoing his transformation too often, so she's going to monitor his activities in secret over the course of one day. She's noticed that Bruce's mind essentially keeps track of an "anger level", an integer which starts at 0 at the beginning of each day. During a particular day, Bruce will undergo a sequence of experiences after waking up, with the -th one causing his anger level to increase by . Note that his anger level may become negative during the day.
Bruce takes the form of the Hulk whenever his anger level is or greater. This means that he transforms into the Hulk whenever his anger level goes from being less than to being greater than or equal to . Natasha is interested in counting the number of times that this transformation takes place (in other words, the number of experiences which cause Bruce to go from not being the Hulk to suddenly being the Hulk). Can you help her count them?
Input Specification
The first line of input consists of a single integer, .
lines follow, the -th of which consists of a single integer,
, for .
Output Specification
Output a single integer, the number of times which Bruce Banner transforms into the Hulk.
Sample Input
6
4
4
3
2
-4
1
Sample Output
2
Sample Explanation
Bruce transforms into the Hulk as a result of the rd experience (which increases his anger level from to ), and again as a result of the 6th experience (which increases his anger level from to ).
Comments