/**
 *    author:  orzvanh14 ( Độc cô cầu đặc )
 *    created: 18.04.2026 03:56:02
 *    too lazy to update time
**/
// i wants to take ioi
//binhtinhtutinkhongcaycunhungmotkhikhongcontutinnualatuyetvong
#include <bits/stdc++.h>

using namespace std;

#define int long long
#define nn "\n"
#define pi pair<int, int>
#define ti tuple<int, int, int>
#define fi first
#define se second
#define lb lower_bound
#define ub upper_bound
#define eb emplace_back
#define pb push_back
#define TASK " "

#define ms(a, x) memset(a, x, sizeof(a))
#define all(a) a.begin(), a.end()
#define All(a, n) a + 1, a + 1 + n

#define LOG 19

const int INF = 1e18;
const int N = 1e5 + 5;
const int maxn = 100 + 5;
const int mod = 1e9 + 7;


struct node{
	int kc, u;
	bool operator<(const node& other) const {
        return kc > other.kc;
    }
};
int n;
void nhap(){

}
void solve(){
    while(cin >> n){
        if(n == 0) return;
        vector<int> a(n + 5);
        for(int i = 1; i <= n; i++){
            cin >> a[i];
        }
        stack<int> st;
        int cur = 1;
        bool ok = 1;
        for(int i = 1; i <= n; i++){
            if(a[i] != cur){
                st.push(a[i]);
            }
            else{
                cur++;
            }
        }
        while(!st.empty()){
            int x = st.top();
            st.pop();
            if(x == cur){
                cur++;
            }
            else{
                ok = 0;
            }
        }
        if(!ok){
            cout << "no" << nn;
        }
        else cout << "yes" << nn;
    }
}
signed main(){
//    freopen("wormsort.in", "r", stdin);
//	freopen("wormsort.out", "w", stdout);
	ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	nhap();
	solve();
	return 0;
}
