|시간 제한||메모리 제한||제출||정답||맞은 사람||정답 비율|
|1 초||128 MB||2||1||1||50.000%|
Imagine the airplane in which exist only one corridor through the rows of seats and passengers, which are entering in the corridor and looking for their seats.
Each passenger must seat on his seat, and entrance to airplane is on the begging, just in front of first row of seats. Passengers are entering one after another, without any unnecessary stops.
Passenger is walking through corridor in the direction of his seat and in each row he stay for exactly one second (or more, if in front of them is another passenger) until he arrive to his row and then he stay in his row for five seconds (because of putting luggage). In each second in the corridor at one row can be only one passenger.
Write the program which will calculate how much time is needed that corridor become free i.e. that all passengers seat on their seats.
In the first line of input file there is integer N, number of passengers, 1 ≤ N ≤ 1000.
In (i+1)-th line is one integer Ri , number of row where the passenger number i must seat, 1 ≤ Ri ≤ 1000.
Passengers are numerated with number from 1 to N, and they are entering in that order. Number of passengers who are seating in the same row is not limited.
In first and only line of output file you should write time (in seconds) that is needed that all the passengers seat on their seats.
2 3 3
4 4 4 1 5