#include<stdio.h>
void my_remove(int arr[], int x, int n)
{
//int m = 49;
for (n; n >= x; n--)
{
arr[n ] = arr[n-1];
}
}
int main()
{
int a = 0; int b = 0; int c = 0; int n = 0;
int arr[51] = { 0 }; //真的无语
scanf("%d", &n); //原来是加了不该家的\n
for (a = 0; a < n; a++)
{
scanf("%d", &arr[a]);
}//printf("\n");
scanf("%d", &c);
for (b = 0; b < n; b++)
{
if (c > arr[n-1])
{
arr[n] = c; break;
}
if (c < arr[b])
{
my_remove(arr, b, n);
arr[b] = c; break;
}
if (c > arr[b])
continue;
}
for (int i = 0; i < n + 1; i++)
printf("%d ", arr[i]);
return 0;
}
void my_remove(int arr[], int x, int n)
{
//int m = 49;
for (n; n >= x; n--)
{
arr[n ] = arr[n-1];
}
}
int main()
{
int a = 0; int b = 0; int c = 0; int n = 0;
int arr[51] = { 0 }; //真的无语
scanf("%d", &n); //原来是加了不该家的\n
for (a = 0; a < n; a++)
{
scanf("%d", &arr[a]);
}//printf("\n");
scanf("%d", &c);
for (b = 0; b < n; b++)
{
if (c > arr[n-1])
{
arr[n] = c; break;
}
if (c < arr[b])
{
my_remove(arr, b, n);
arr[b] = c; break;
}
if (c > arr[b])
continue;
}
for (int i = 0; i < n + 1; i++)
printf("%d ", arr[i]);
return 0;
}