loc

I'm the headmaster for a not so calm class of 9th graders. After the first few weeks of school I've come to the conclusion that I have to change the seating of the students. So I numbered all the seats from 1 to n and decided how to seat the students. From here on I'll consider that student 1 is the one standing in seat 1, student 2 in seat 2, and so on.
Obviously, the first time I checked up on them I found the students seated in a totally different order.
I therefore proceeded to ask them to take their places back, as I had assigned them.
In order not to create a disturbance in the class I set the following procedure:
if student i is not in his/her place (so if he/she is not sitting in seat i) he/she gets up, goes to his/her chair; if his/her seat is occupied the student sitting in seat i gets up, seat i is occupied by student i, and the one that got up looks for his/her place in the same manner, until the last student to stand up finds his/her seat empty.

Obviously, the process is repeated until all students are seated in their places.

Task
Write a program that determines how many times the procedure has to be repeated so that all the students are back in their seats.

Input Data
Input file loc.in will contain on the first line a positive integer n, representing the total number of students in the class.
The following n lines present the way the students were found when I came to check up on them.
More specifically, the (i+1)th line contains the number of the student sitting in seat i.

Output Data
Output file loc.out will contain a single line with a positive integer representing the number of procedure repetitions required so that all students go back to their seats.

Constraints and Mentions
1 <= n <= 1000

Examples

loc.in loc.out Explanation
5
3
4
5
2
1
2

1. Student 3 gets up, goes to his seat (seat 3); student 5 gets up from seat 3, then goes to his seat, from which student 1 gets up, and finds his empty seat.
2. Student 4 gets up, goes to his seat (seat 4), from which student 2 gets up and goes to his seat, which he finds empty.

Time limit: 0.1 seconds/test

Marinel Serban
Computer Science High School "Gr. C. Moisil" Iasi
marinel_serban@yahoo.com