Time limit: 1s
Memory limit: 256MB
Input:
Output:
Pompieru is hungry and wants to cook the famous Half-Pound Sandwich. He is given a list of ingredients, each one with an integer flavor-value .
However, the Half-Pound Sandwich is very special, with some specific rules in its receipt:
- Ingredients are used in the order they are given. The first ingredient used must be the first one in the list, and so on.
- The sandwich consists of one or more levels. Each level must include one or more consecutive ingredients, and each ingredient must be part of exactly one level.
- The total flavor value of each level must be positive.
Task
Given the rules above, determine the maximum number of levels the sandwich can have.
Input data
On the first line of the input you are given , the number of ingredients.
On the second line there are integers, the -th of which represents the flavor-value of the -th ingredient.
Output data
On the first and only line of the output print the integer , the maximum number of levels the sandwich can have.
Constraints and clarifications
- for each .
- The sum of all flavour-values is positive.
# | Points | Constraints |
---|---|---|
1 | 0 | Examples |
2 | 15 | , , for each |
3 | 20 | |
4 | 20 | |
5 | 45 | No additional constraints |
Example 1
stdin
5
1 2 3 -4 5
stdout
4
Example 2
stdin
11
10 -1 1 -9 1 1 1 1 1 1 1
stdout
8