#include <iostream>
using namespace std;
int main()
{
int n, k, x;
cin >> n;
int arr[50] = { 0 };
for (k = 0; k < n; k++)
{
cin >> arr[k];
}
cin >> x;
int i=0, j=0;
while (i < n)
{
if (arr[i] != x)
{
arr[j++] = arr[i++];
}
else
{
i++;
}
}
for (i = 0; i < j; i++)
{
cout << arr[i]<<" ";
}
return 0;
}
using namespace std;
int main()
{
int n, k, x;
cin >> n;
int arr[50] = { 0 };
for (k = 0; k < n; k++)
{
cin >> arr[k];
}
cin >> x;
int i=0, j=0;
while (i < n)
{
if (arr[i] != x)
{
arr[j++] = arr[i++];
}
else
{
i++;
}
}
for (i = 0; i < j; i++)
{
cout << arr[i]<<" ";
}
return 0;
}