wind training
#include <bits/stdc++.h>
#define pb push_back
#define fi first
#define se second
#define int long long
#define pii pair<long long, long long>
#define endl "\n"
#define TIME (1.0 * clock() / CLOCKS_PER_SEC)
#define MASK(i) (1ll<<(i))
#define FILE(A) freopen(A".INP", "r", stdin); freopen(A".OUT", "w", stdout)
#define BIT(Mask, i) (((Mask)>>(i))&1)
using namespace std;
const int N = 1e5+5;
const int MOD = 1e9+7;
const int INF = 1e16 ;
const int Lim = 1e9 ;
const int BASE = 31 ;
int n, a[N];
void solve() {
for (int i=1;i <= n;i++) {
cin >> a[i];
}
stack<int> s;
int cur = 1;
for (int i=1;i <= n+1;i++) {
while(!s.empty() && cur == s.top()) {
cur++;
s.pop();
}
if (cur == a[i]) {
cur++;
}
else {
s.push(a[i]);
}
}
if (cur == n+1) {
cout << "yes";
}
else {
cout << "no";
}
}
signed main(){
ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
while(cin >> n) {
if (!n) break;
solve();
cout << endl;
}
cerr << "Time elapsed: " << TIME << "s.\n";
return 0;
}
// Nguyen Minh Hieu - 2008 - Gia Lai.
// https://hieuhfgr.pythonanywhere.com/
// .-.. --- ...- . .-.. -.--