#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> ii;
typedef tuple<ll, ll, ll> iii;
typedef vector<ll> vi;
typedef vector<ii> vii;
typedef vector<iii> viii;
typedef vector<vi> vvi;
typedef vector<vii> vvii;
#define REP(i,n) for (ll i = 0; i < n; ++i)
#define REPR(i,n) for (ll i = n-1; i >= 0; --i)
#define FOR(i,m,n) for (ll i = m; i < n; ++i)
#define FORR(i,m,n) for (ll i = n-1; i >= m; --i)
#define FORE(x,xs) for (const auto& x : xs)
#define FORI(i,v) for (auto i = v.begin(); i != v.end(); i++)
#define ALL(v) v.begin(), v.end()
#define CHMIN(x,y) x = min(x, y)
#define CHMAX(x,y) x = max(x, y)

enum QUERY_GET { SUM, MAXIMUM, MINIMUM, BITOR };
template <class T = int>
class SegmentTree {
private:
    int ARY_SIZE;
    T initVal;
    std::vector<T> ary;
    std::function<T(T&, T&)> merge;
 
    void init(int n, QUERY_GET qtype) {
        switch (qtype) {
        case SUM:
            initVal = 0;
            merge = [](T& l, T& r) {return l + r; };
            break;
        case MAXIMUM:
            initVal = std::numeric_limits<T>::lowest();
            merge = [](T& l, T& r) {return (l > r) ? l : r; };
            break;
        case MINIMUM:
            initVal = std::numeric_limits<T>::max();
            merge = [](T& l, T& r) {return (l < r) ? l : r; };
            break;
        case BITOR:
            initVal = 0;
            merge = [](T& l, T& r) {return l | r; };
            break;
        default: struct INVALID_QUERY_TYPE_ERROR {}; throw INVALID_QUERY_TYPE_ERROR(); break;
        }
        init(n);
    }
    void init(int n) {
        while (ARY_SIZE < n) ARY_SIZE <<= 1;
        ary.resize(ARY_SIZE << 1, initVal);
    }
public:
    SegmentTree() {}
    SegmentTree(int n, QUERY_GET qtype) : ARY_SIZE(1) { init(n, qtype); }
    SegmentTree(int n, T initVal, std::function<T(T&, T&)> f) : ARY_SIZE(1), initVal(initVal), merge(f) { init(n); }
 
    inline void update(int i, T val) {
        i += ARY_SIZE;
        ary[i] = val;
        while (i > 1) {
            i >>= 1;
            ary[i] = merge(ary[i << 1], ary[(i << 1) + 1]);
        }
    }

    inline void add(int i, T val) {
        update(i, ary[i + ARY_SIZE] + val);
    }

    inline T query(int l, int r) {
        if (l >= r) return initVal;
        T vl = initVal, vr = initVal;
        for (l += ARY_SIZE, r += ARY_SIZE; l != r; l >>= 1, r >>= 1) {
            if (l & 1) vl = merge(vl, ary[l++]);
            if (r & 1) vr = merge(ary[--r], vr);
        }
        return merge(vl, vr);
    }

    T operator[](int i) { return ary[i + ARY_SIZE]; }
 
    void debugShow() {
        for (int i = ARY_SIZE; i < ARY_SIZE << 1; ++i) std::cerr << ary[i] << " ";
        std::cerr << "\n";
    }
};

template<int mod> struct ModInt {
    int64_t x;
    ModInt() : x(0) {}
    ModInt(int64_t y) : x(y >= 0 ? y % mod : (y % mod + mod) % mod) {}

    ModInt &operator+=(const ModInt &a) {
        if ((x += a.x) >= mod) x -= mod;
        return *this;
    }

    ModInt &operator-=(const ModInt &a) {
        if ((x += mod - a.x) >= mod) x -= mod;
        return *this;
    }

    ModInt &operator*=(const ModInt &a) {
        x = 1LL * x * a.x % mod;
        return *this;
    }

    ModInt &operator/=(const ModInt &a) {
        *this *= a.inverse();
        return *this;
    }

    ModInt operator-() const {
        return ModInt(-x);
    }

    ModInt operator+(const ModInt a) const {
        return ModInt(*this) += a;
    }

    ModInt operator-(const ModInt a) const {
        return ModInt(*this) -= a;
    }

    ModInt operator*(const ModInt a) const {
        return ModInt(*this) *= a;
    }

    ModInt operator/(const ModInt a) const {
        return ModInt(*this) /= a;
    }

    bool operator==(const ModInt a) const {
        return x == a.x;
    }

    bool operator!=(const ModInt a) const {
        return x != a.x;
    }

    ModInt pow(int64_t k) const {
        ModInt ret(1), mul(x);
        while (k > 0) {
            if (k & 1) ret *= mul;
            mul *= mul;
            k >>= 1;
        }
        return ret;
    }

    ModInt inverse() const {
        return pow(mod - 2);
    }

    friend ostream &operator<<(ostream &os, const ModInt &p) {
        return os << p.x;
    }

    friend istream &operator>>(istream &is, ModInt &a) {
        int64_t t;
        is >> t;
        a = ModInt<mod>(t);
        return (is);
    }
};

const int MOD = 1e9+7;
using modint = ModInt<MOD>;

const int MAX = 2e5+10;

int N;
ll X[MAX];

modint solve() {
    vi r(N);
    r[0] = r[1] = 1;
    FOR (i, 2, N) {
        if (X[i-1] >= 2 * (i-r[i-1]) + 1) r[i] = r[i-1];
        else r[i] = r[i-1]+1;
    }
    modint ret(1);
    int cur = 1;
    int i = 0;
    do {
        while (i < N && r[i] <= cur) i++;
        ret *= modint(i - cur + 1);
        cur++;
    } while (cur <= N);
    return ret;
}

int main() {
    cin >> N;
    REP (i, N) cin >> X[i];
    cout << solve() << endl;
}

Measured memory_bytes: 1792