# Problem: Chocolate Shop

Want to try solving this problem? You can submit your code online if you log in or register.

## Chocolate Shop

Input File: chocin.txt
Output File: chocout.txt
Time Limit: 1.2 seconds

Each weekend you work in a local chocolate shop. The chocolates are stored in boxes with ten chocolates in each box. Each time a customer comes in to buy some chocolates you take them from an already-open box. If there are not enough chocolates in the current box, you completely finish the box before opening a new box. You are not allowed to have any more than one box open at a time, and you cannot open a new box unless a customer has purchased some of the chocolates in that box.

The chocolates in this shop are particularly famous, so every person who comes in buys at least one chocolate. However, as they are very expensive, no one ever buys more than nine.

At the start of the day, there are no open boxes. If at the end of the day the currently open box has chocolates left in it, you are allowed to take them home and share them with your friends (or just eat them yourself if you are feeling greedy). Your task is to write a program that reads in the series of purchases for the day and prints how many chocolates you will get at the end.

### Input

The first line of the input file will contain a single integer N, the number of purchases that have taken place during the day ( 0  <= N  <= 10000000). Following this will be N lines listing the day's purchases in the order they took place. Each of these lines will contain a single digit between 1 and 9, inclusive.

### Output

Your output file should contain a single integer, giving the number of chocolates you will take home at the end of the day.

### Sample Input

10
2
9
4
7
8
3
2
5
3
4


### Sample Output

3


### Scoring

The score for each input scenario will be 100% if the correct answer is written to the output file, and 0% otherwise.

Privacy statement
Page generated: 25 March 2023,  7:30pm AEDT