while True:
n=int(input())
if n==0:
break
while True:
num=list(map(int,input().split()))
if num==[0]:
break
stack=[0]
y=[i for i in range(1,n+1)]
f=True
for i in num:
while True:
if i==stack[-1]:
stack.pop()
break
elif i>stack[-1]:
stack.append(y.pop(0))
elif i<stack[-1]:
f=False
break
if f==False:
print("No")
break
else:
print("Yes")