#ABC474B. 离场顺序 / Exit Order

离场顺序 / Exit Order

Problem Statement

There is a movie theater with NN seats numbered 11 through NN, and one customer is sitting in each seat. As a measure against congestion, this theater has customers leave according to the following rule.

  • Divide the customers into groups of 1010 people each, in increasing order of the seat number they are sitting in.
  • The groups leave in order, starting from the group consisting of customers with the smallest seat numbers. Customers within the same group may leave in any order.

Here, the last group may have fewer than 1010 customers.

The customer who left ii-th was the one sitting in seat PiP_i. Determine whether the NN customers left according to the rule.

Constraints

  • 10N10010 \leq N \leq 100
  • (P1,P2,,PN)(P_1,P_2,\dots,P_N) is a permutation of (1,2,,N)(1,2,\dots,N).
  • All input values are integers.

Input

The input is given from Standard Input in the following format:

  • NN
  • P1P_1 P2P_2 \dots PNP_N

Output

Output Yes if the NN customers left according to the rule, and No otherwise, in one line.

25
1 6 5 7 8 10 2 4 3 9 15 17 12 11 19 20 18 13 14 16 21 23 24 22 25
Yes

The 2525 customers were divided into three groups, with seat numbers 11 to 1010, 1111 to 2020, and 2121 to 2525. First, the 1010 customers in the first group, with seat numbers 11 to 1010, left. Next, the 1010 customers in the second group, with seat numbers 1111 to 2020, left. Finally, the 55 customers in the third group, with seat numbers 2121 to 2525, left. Thus, the 2525 customers left according to the rule.

11
11 10 7 2 1 5 6 4 8 9 3
No