#include<stdio.h>
int main()
{
    int a = 0, b, n;
    int arr[20] = { 0 };
    scanf("%d", &a);
    for (int i = 0; i < a; i++)
    {
        scanf("%d", &arr[i]);
        n = i;
    }
    scanf("%d", &b);
    if (arr[n] < b)
    {
        arr[n + 1] = b;
    }
    for (; n >= 0; n--)
    {
        arr[n + 1] = arr[n];
        if (arr[n]<b)
        {
            arr[n+1] = b;
            break;
        }
        /*else
            arr[n] = b;*/
        if (n == 0)
            arr[0] = b;
    }
    for (int i = 0; i < a + 1; i++)
    {
        printf("%d ", arr[i]);
    }
    return 0;
}