// ConsoleApplication1.cpp : This file contains the 'main' function. Program execution begins and ends there.
//
#include <iostream>
using namespace std;
int a[100000] = { 0 };
int main()
{
int t;
cin >> t;
bool flag=1 ;
for (int i = 0;i < t;i++) {
cin >> a[i];
}
for (int i = 0;i < t-1;i++) {
if (a[i] < a[i + 1]) {
flag = 1;
}
else {
flag = 0;
break;
}
}
if (flag == 1) {
cout << "YES";
}
else {
cout << "NO";
}
}