You are developing frog-shaped robots and want to race them. Initially, you place N robots on a number line, each with a unique coordinate. Robots can jump to adjacent unoccupied coordinates. When a robot's coordinate becomes 0 or less, it's removed. Find the number of different orders in which the N robots can finish the race, considering the modulo 10^9+7. Constraints: 2 ≤ N ≤ 10^5, 0 < x1 < x2 < ... < xN ≤ 10^9. For a partial score of 500 points, N ≤ 8. Input format: N followed by N coordinates. Output the number of different orders modulo 10^9+7.

# Buggy version:
import sys
# from collections import defaultdict, deque
# import math
# import copy
from bisect import bisect_left, bisect_right
# import heapq

# sys.setrecursionlimit(1000000)

# input aliases
input = sys.stdin.readline

getS = lambda: input().strip()
getN = lambda: int(input())
getList = lambda: list(map(int, input().split()))
getZList = lambda: [int(x) - 1 for x in input().split()]

INF = 10 ** 20
MOD = 1000000007
def solve():
    n = getN()
    nums = getList()
    kaijyo = [1, 1]

    for i in range(2, n + 3):
        kaijyo.append((kaijyo[-1] * i % MOD))

    ans = 1
    prev = -1
    sukima = 0
    cnt = 0
    for num in nums:
        sukima += num - prev - 1

        if sukima < cnt:
            ans *= kaijyo[cnt]
            ans %= MOD
            cnt -= 1
            sukima += 1
        cnt += 1
        prev = num
        # print(ans, cnt, sukima)
    ans *= kaijyo[cnt]
    ans %= MOD
    print(ans)

def main():
    n = getN()
    for _ in range(n):
        solve()
if __name__ == "__main__":
    # main()
    solve()


# Fixed version:
import sys
# from collections import defaultdict, deque
# import math
# import copy
from bisect import bisect_left, bisect_right
# import heapq

# sys.setrecursionlimit(1000000)

# input aliases
input = sys.stdin.readline

getS = lambda: input().strip()
getN = lambda: int(input())
getList = lambda: list(map(int, input().split()))
getZList = lambda: [int(x) - 1 for x in input().split()]

INF = 10 ** 20
MOD = 10 ** 9 + 7
def solve():
    n = getN()
    nums = getList()
    kaijyo = [1, 1]

    for i in range(2, n + 3):
        kaijyo.append((kaijyo[-1] * i % MOD))
    # print(kaijyo)

    ans = 1
    cnt = 0
    for num in nums:
        cnt +=1
        if num <= (cnt - 1) * 2:
            # ans *= kaijyo[cnt]
            ans *= cnt
            ans %= MOD
            cnt -= 1

        prev = num
    ans *= kaijyo[cnt]
    ans %= MOD
    print(ans)
    # print((11 * kaijyo[10]) % MOD)
    # print(pow(311014372, MOD -2, MOD))

def main():
    n = getN()
    for _ in range(n):
        solve()
if __name__ == "__main__":
    # main()
    solve()

# Buggy version:
mod = 10 ** 9 + 7
n = int(input())
X = list(map(int, input().split()))

ans = []
now_x = 0
now_num = 0
free = n
for k,x in enumerate(X):
  now_num += 1
  dist = x - now_x
  if dist // 2 + 1 < now_num:
    ans += [free] * (now_num-1)
    free -= 1
    now_num = 1
    now_x = x-1
ans += [free] * now_num
res = 1
res2 = 1
print(ans)
for k,v in enumerate(ans[::-1]):
  print(v-k)
  res *= v-k
  res %= mod
print(res)

# Fixed version:
mod = 10 ** 9 + 7
n = int(input())
X = list(map(int, input().split()))

ans = []
now_x = 0
now_num = 0
free = n
for k,x in enumerate(X):
  now_num += 1
  dist = x - now_x
  if (dist-1) // 2 + 1 < now_num:
    ans += [free] * (now_num)
    free -= 1
    now_num = 0
    now_x = x
ans += [free] * now_num
res = 1
for k,v in enumerate(ans[::-1]):
  res *= v-k
  res %= mod
print(res)

# Buggy version:
input()
a=b=1
for r in input().split():
    a*=b%(10**+7)
    if b*2<eval(r+'+2'):b+=1
print(a)

# Fixed version:
input()
a=b=1
for r in input().split():
    a=a*b%(10**9+7)
    if b*2<eval(r+'+2'):b+=1
print(a)