#include <bits/stdc++.h>
using namespace std;
#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
template <class X>
void printarr(X arr[], long long n) {
  for (long long i = 0; i < n; ++i) cout << arr[i] << " ";
  cout << "\n";
}
template <typename X>
ostream& operator<<(ostream& x, const vector<X>& v) {
  for (X a : v) x << a << ' ';
  return x;
}
template <typename X, typename Y>
ostream& operator<<(ostream& x, const vector<pair<X, Y> >& v) {
  for (pair<X, Y> it : v) x << it.first << ' ' << it.second << "\n";
  return x;
}
template <typename T, typename second>
ostream& operator<<(ostream& os, const map<T, second>& v) {
  for (pair<T, second> it : v) os << it.first << " => " << it.second << "\n";
  return os;
}
double pi = 3.14159265358979323846264338327950288419716939937510582097494459230;
long long modulo = 1e9 + 7;
long long fpow(long long a, long long n) {
  long long ans = 1;
  while (n) {
    if (n & 1) ans = (ans * a) % modulo;
    a = (a * a) % modulo;
    n = n >> 1;
  }
  return ans;
}
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  long long n;
  cin >> n;
  long long arr[n];
  for (long long i = 0; i < n; ++i) cin >> arr[i];
  long long cnt = 0;
  for (long long i = 1; i < n; ++i) {
    if (cnt == 0 and arr[i] < arr[i - 1])
      cnt = 1;
    else if (cnt == 1 and arr[i] > arr[i - 1]) {
      cout << "no";
      return 0;
    }
  }
  cout << "yes";
  return 0;
}
