WC '17 Contest 4 J2 - Anger Management

View as PDF

Submit solution


Points: 3
Time limit: 1.0s
Memory limit: 16M

Author:
Problem type
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 N (1 \le N \le 100) experiences after waking up, with the i-th one causing his anger level to increase by A_i (-5 \le A_i \le 5). Note that his anger level may become negative during the day.

Bruce takes the form of the Hulk whenever his anger level is 10 or greater. This means that he transforms into the Hulk whenever his anger level goes from being less than 10 to being greater than or equal to 10. 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, N.
N lines follow, the i-th of which consists of a single integer, A_i, for i = 1 \dots N.

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 3rd experience (which increases his anger level from 8 to 11), and again as a result of the 6th experience (which increases his anger level from 9 to 10).


Comments

There are no comments at the moment.