#include<stdio.h>
#define L 10
int main()
{
int N,i,X,n,a,t,m;
int b[L];
scanf("%d",&N);
for(i=1;i<=N;i++)
{
scanf("%d",&X);b[i]=X;
}
scanf("%d",&a);
for(i=1;i<=N;i++)
{
if(b[i]>a)
{t=b[i];
b[i]=a;m=b[i+1];b[i+1]=t;
for(;i<=N+1;i++)
{t=b[i+2];
b[i+2]=m;
m=t;
}
}
}
for(i=1;i<=N+1;i++)
printf("%d ",b[i]);
}