#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  vector<int> a(n);
  for (int &i : a) cin >> i;
  int m = a[0], mi = 0;
  for (int i = 1; i < n; i++) {
    if (a[i] > m) {
      m = a[i];
      mi = i;
    }
  }
  for (int i = mi + 1; i < n; i++) {
    if (a[i] >= a[i - 1]) {
      cout << "No\n";
      return 0;
    }
  }
  for (int i = mi - 1; i >= 0; i--) {
    if (a[i] >= a[i + 1]) {
      cout << "No\n";
      return 0;
    }
  }
  cout << "Yes\n";
  return 0;
}
