#include <bits/stdc++.h>
using namespace std;
long long gcd(long long int a, long long int b) {
  if (b == 0) return a;
  return gcd(b, a % b);
}
long long lcm(int a, int b) { return (a / gcd(a, b)) * b; }
long long pow2(long long n) {
  if (n == 0) return 1;
  if (n == 1) return 2;
  return pow2(n - 1) * 2;
}
int main() {
  long long t;
  t = 1;
  while (t--) {
    long long n;
    cin >> n;
    long long a[n];
    long long z = 0, index = 0;
    for (long long i = 0; i < n; i++) {
      cin >> a[i];
      if (z < a[i]) {
        z = a[i];
        index = i;
      }
    }
    for (long long i = index; i > 0; i--) {
      if (a[i] > a[i - 1]) {
      } else {
        cout << "No" << endl;
        return 0;
      }
    }
    for (long long i = index; i < n - 1; i++) {
      if (a[i] > a[i + 1]) {
        ;
      } else {
        cout << "No" << endl;
        return 0;
      }
    }
    cout << "Yes" << endl;
  }
}
