#include<cstdio> #include<cstring> #include<stack> using namespace std; const int maxn=1005; stack <int> S; int x[maxn]; int main() { int n,y,i,j; bool yes; while (scanf("%d",&n)&&n){ while (scanf("%d",&x[0])&&x[0]){ for (i=1;i<n;i++) scanf("%d",&x[i]); while (!S.empty()) S.pop(); yes=1; j=1; for (i=0;yes&&i<n;i++){ while (j<=x[i]){ S.push(j); j++; } y=S.top(); S.pop(); if (x[i]!=y) yes=0; } printf("%s/n",yes?"Yes":"No"); } printf("/n"); } return 0; }