A chocolate problem

0

0 votes
Medium
Problem

Chocolates are being distributed in MNNIT. There are N people numbered from 1 to N that are lined up in a queue. Initially, ith numbered person is standing at ith position from the top .The person standing in front of the line will receive a chocolate. Upon receiving a chocolate he/she shall go back to the end of the queue and wait for another round.
But being notorious, people decided to cut the queue i.e. they will not line up again at the end of the queue but may skip some number of person from the end and will position (him/her)self in front of them.
More specifically a person numbered i will skip excatly Pi person from the end and will position himself in front of P persons.At any moment there will be N persons in the queue.
Given that there are infinite amount of chocolates and no person leaves the queue find out how many person will receive no chocolate at all. 

Input Format

The first line of input contains a single integers N .
Next line will contain N space separated integers Pi i,e the number of people the ith person will cut.

Output Format

Output the number of people who couldnt receive any chocolates.

Constraints

1N105

0PiN1

Time Limit: 1
Memory Limit: 256
Source Limit:
Editor Image

?