Lisa just got a new math workbook. A workbook contains exercise problems, grouped into chapters.
- There are chapters in Lisa’s workbook, numbered from to .
- The -th chapter has problems, numbered from to .
- Each page can hold up to problems. There are no empty pages or unnecessary spaces, so only the last page of a chapter may contain fewer than problems.
- Each new chapter starts on a new page, so a page will never contain problems from more than one chapter.
- The page number indexing starts at .
Lisa believes a problem to be special if its index (within a chapter) is the same as the page number where it’s located. Given the details for Lisa’s workbook, can you count its number of special problems?
Note: See the diagram in the Explanation section for more details.
The first line contains two integers
The second line contains integers where denotes the number of problems in the -th chapter.
Print the number of special problems in Lisa’s workbook.
5 3 4 2 6 1 10
The diagram below depicts Lisa’s workbook withchapters and a maximum of problems per page. Special problems are outlined in red, and page numbers are in yellow squares.
There arespecial problems and thus we print the number on a new line.