#include <bits/stdc++.h>

using namespace std;

template<typename S, typename T>
ostream& operator<<(ostream& out, const pair<S, T> p) {
    out << "(" << p.first << "," << p.second << ")";
    return out;
}

template<typename T>
ostream& operator<<(ostream& out, const vector<T>& v) {
    for (auto a: v)
        out << a << " ";
    return out;
}

template<typename T>
ostream& operator<<(ostream& out, const set<T>& S) {
    for (auto a: S)
        cout << a << " ";
    return out;
}

template<typename T>
ostream& operator<<(ostream& out, const multiset<T>& S) {
    for (auto a: S)
        cout << a << " ";
    return out;
}

template<typename S, typename T>
ostream& operator<<(ostream& out, const map<S, T>& M) {
    for (auto m: M)
        cout << "(" << m.first << "->" << m.second << ") ";
    return out;
}

template<typename S, typename T>
pair<S, T> operator+(pair<S, T> a, pair<S, T> b) {
    return make_pair(a.first + b.first, a.second + b.second);
}

template<typename S, typename T>
pair<S, T> operator-(pair<S, T> a, pair<S, T> b) {
    return make_pair(a.first - b.first, a.second - b.second);
}

template<typename T>
struct SegmentTree {
    int n;
    vector<T> minv;
    const T inf = numeric_limits<T>::max();

    void init(int n) {
        this->n = n;
        minv.assign(2 * n - 1, 0);
    }

    template<typename ParameterType>
    void buildup(vector<ParameterType>& A) {
        n = A.size();
        minv.resize(2 * n - 1);
        for (int i = 0; i < n; i++)
            minv[i + n - 1] = A[i];
        for (int i = n - 2; i >= 0; i--)
            minv[i] = min(minv[(i<<1) + 1], minv[(i<<1) + 2]);
    }

    void add_value(int x, T val) {
        x += n -1;
        minv[x] += val;
        while (x) {
            x = ((x - 1)>>1);
            minv[x] = min(minv[(x<<1) + 1], minv[(x<<1) + 2]);
        }
    }

    void set_value(int x, T val) {
        x += n -1;
        minv[x] = val;
        while (x) {
            x = ((x - 1)>>1);
            minv[x] = min(minv[(x<<1) + 1], minv[(x<<1) + 2]);
        }
    }

    T query_minimum_value(int x, int y) {
        x += n - 1;
        y += n - 1;
        T ans = inf;
        while (x <= y) {
            if (!(x & 1)) {
                ans = min(ans, minv[x++]);
            } else if (y & 1) {
                ans = min(ans, minv[y--]);
            } else {
                x = ((x - 1)>>1);
                y = ((y - 1)>>1);
            }
        }
        return ans;
    }

    T query_global_minimum_value() {
        return minv[0];
    }

    vector<T> unwind() {
        vector<T> A(n);
        for (int i = 0; i <  n; i++)
            A[i] = query_minimum_value(i, i);
        return A;
    }
};

SegmentTree<int> segment;

int main() {
    ios_base::sync_with_stdio(0); cin.tie(0);
    int n;
    vector<int> A;
    cin >> n;
    A.resize(n);
    for (int i = 0; i < n; i++)
        cin >> A[i];
    segment.buildup(A);
    for (int i = 0; i < n; i++) {
        if (i + 1 < n) {
            if (A[i] > segment.query_minimum_value(i + 1, n - 1)) {
                A[i] -= 1;
                segment.add_value(i, -1);
            }
        }
    }
    bool ok = true;
    for (int i = 1; i < n; i++) {
        if (A[i] < A[i-1]) {
            ok = false;
            break;
        }
    }
    if (ok)
        cout << "Yes" << endl;
    else
        cout << "No" << endl;
    return 0;
}


Measured memory_bytes: 1408