#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using db = double;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
const int N = 2e5 + 10;
const ll inf = 1e15 + 42;
void testCase() {
  int n;
  cin >> n;
  int a[n];
  int mx = 0;
  int indx = -1;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
    if (a[i] > mx) {
      mx = a[i];
      indx = i;
    }
  }
  int ok = 1;
  for (int i = indx - 1; i >= 0; i--) {
    if (a[i] < a[i + 1])
      continue;
    else {
      ok = 0;
      break;
    }
  }
  if (ok) {
    for (int i = indx + 1; i < n; i++) {
      if (a[i] < a[i - 1])
        continue;
      else {
        ok = 0;
        break;
      }
    }
  }
  if (ok)
    cout << "Yes"
         << "\n";
  else
    cout << "No"
         << "\n";
}
int main() {
  ios_base ::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  testCase();
  return 0;
}
