include

int main()
{
int b,c,a[51];
scanf("%d",&b);
for(int i=0;i<b;i++)
scanf("%d ",&a[i]);
scanf("%d",&c);
for(int i=b-1;i>=0;i--)
{
if(c>=a[i])
{a[i+1]=c;break;}
else
{a[i+1]=a[i];a[i]=c;}
}
for(int i=0;i<b+1;i++)
printf("%d ",a[i]);
}