#include "stdafx.h"
#include <stdio.h>
#include <stdlib.h>
const int MAXN = 1000 + 10;
int n, target[MAXN];
int main()
{
while(scanf_s("%d",&n,sizeof(n)) == 1)
{
int stack[MAXN],top = 0;
int A = 1, B = 1;
for(int i = 1;i < n;i++)
{
scanf_s("%d",&target[i],sizeof(target[i]));
}
int ok = 1;
while(B <= n)
{
if(A == target[B])
{
A++;
B++;
}
else
if(top && stack[top] == target[B])
{
top--;
B++;
}
else
if(A <= n)
stack[++top] = A++;
else
{
ok = 0;
break;
}
printf_s("%s\n",ok?"Yes":"No");
}
system("pause");
return 0;
}
}