#include<stdio.h>
#include<stdlib.h>
#define LISTINITSIZE 20
#define INCREAMENT 5
typedef int ElemType;
typedef struct
{
ElemType *elem;
int length;
int listsize;
}Seqlist;
void Initlist(Seqlist *L)
{
int n, i;
L->elem=(ElemType *)malloc(sizeof(ElemType)*LISTINITSIZE);
scanf("%d", &n);
for(i=0;i<n;i++)
{
scanf("%d", &L->elem[i]);
}
L->length=n;
L->listsize=LISTINITSIZE;
}
void Prtlist(Seqlist L)
{
int i;
for(i=0;i<L.length;i++)
{
printf("%d ",L.elem[i]);
}
}
void fun(Seqlist *L,ElemType x)
{
int i,t=L->elem[0],j,q=L->length-1;
for(i=0;i<L->length;i++){
if(t>L->elem[i]){
t=L->elem[i];
}
}
for(i=0;i<=q;q--){
if(t==L->elem[q]){
j=q;
break;
}
}
j+=1;
for(i=L->length-1;i>=j-1;i--){
L->elem[i+1]=L->elem[i];
}
L->elem[j-1]=x;
L->length++;
}
int main(void)
{
Seqlist L;
ElemType x;
Initlist(&L);
scanf("%d", &x);
fun(&L,x);
Prtlist(L);
}