// Build Stairs.cpp : This file contains the 'main' function. Program execution begins and ends there.
//

#include <iostream>
using namespace std;

const int N = 1e5;
int arr[N];

int main()
{
	int n;

	cin >> n;
	for(int i= 0 ; i < n ; i++){
		cin >> arr[i];
	}

	for (int i = n - 1; i >= 1; i--) {
		if (arr[i] < arr[i - 1]) {
			if (arr[i - 1] - arr[i] > 1) {
				cout << "NO";
				return 0;
			}
			else if(arr[i - 1] - arr[i] == 1)
				arr[i - 1]--;
		}
	}
	cout << "YES";


}
