#D4287. Robot Racing
Robot Racing
Robot Racing
You are developing frog-shaped robots, and decided to race them against each other.
First, you placed N robots onto a number line. These robots are numbered 1 through N. The current coordinate of robot i is x_i. Here, all x_i are integers, and 0 < x_1 < x_2 < ... < x_N.
You will repeatedly perform the following operation:
- Select a robot on the number line. Let the coordinate of the robot be x. Select the destination coordinate, either x-1 or x-2, that is not occupied by another robot. The robot now jumps to the selected coordinate.
When the coordinate of a robot becomes 0 or less, the robot is considered finished and will be removed from the number line immediately. You will repeat the operation until all the robots finish the race.
Depending on your choice in the operation, the N robots can finish the race in different orders. In how many different orders can the N robots finish the race? Find the answer modulo 10^9+7.
Constraints
- 2 ≤ N ≤ 10^5
- x_i is an integer.
- 0 < x_1 < x_2 < ... < x_N ≤ 10^9
Input
The input is given from Standard Input in the following format:
N x_1 x_2 ... x_N
Output
Print the number of the different orders in which the N robots can finish the race, modulo 10^9+7.
Examples
Input
3 1 2 3
Output
4
Input
3 2 3 4
Output
6
Input
8 1 2 3 5 7 11 13 17
Output
10080
Input
13 4 6 8 9 10 12 14 15 16 18 20 21 22
Output
311014372
inputFormat
Input
The input is given from Standard Input in the following format:
N x_1 x_2 ... x_N
outputFormat
Output
Print the number of the different orders in which the N robots can finish the race, modulo 10^9+7.
Examples
Input
3 1 2 3
Output
4
Input
3 2 3 4
Output
6
Input
8 1 2 3 5 7 11 13 17
Output
10080
Input
13 4 6 8 9 10 12 14 15 16 18 20 21 22
Output
311014372
样例
13
4 6 8 9 10 12 14 15 16 18 20 21 22
311014372