#include <iostream>
#include <vector>
#include <iterator>
using namespace std;
int main()
{
int size_of_the_sequence;
int temp = 0; //счетчик
cin >> size_of_the_sequence;
vector<double> v1 (size_of_the_sequence);
vector<double> v2;
bool h = true, l = true;
for (int i = 0; i < size_of_the_sequence; i++)
{
cin >> v1[i];
if (i % 4 == 0) temp++;
}
for (int i = 1; i < size_of_the_sequence; i++)
{
if (v1[i - 1] <= v1[i])
{
l = false;
}
if (v1[i - 1] >= v1[i])
{
h = false;
}
}
if (!l && !h)//исходная последовательность не упорядочена ни по возрастанию, ни по убыванию
{
v2.resize(size_of_the_sequence - temp);
int size_of_the_sequence = 0;
for (int i = 0; i < v1.size(); i++)
{
if (i % 4 == 0) { size_of_the_sequence++; continue; }
else v2[i - size_of_the_sequence] = v1[i];
}
v1.resize(size_of_the_sequence - temp);
v1 = v2;
v1.shrink_to_fit();
v2.clear();
}
copy(v1.begin(), v1.end(), ostream_iterator<double>(cout, " "));//выводим исходную последовательность без измений
return 0;
}
I2luY2x1ZGUgPGlvc3RyZWFtPgojaW5jbHVkZSA8dmVjdG9yPgojaW5jbHVkZSA8aXRlcmF0b3I+CiAKdXNpbmcgbmFtZXNwYWNlIHN0ZDsKIAppbnQgbWFpbigpCnsKCWludCBzaXplX29mX3RoZV9zZXF1ZW5jZTsKCWludCB0ZW1wID0gMDsgLy/RgdGH0LXRgtGH0LjQugoJY2luID4+IHNpemVfb2ZfdGhlX3NlcXVlbmNlOwkKCXZlY3Rvcjxkb3VibGU+IHYxIChzaXplX29mX3RoZV9zZXF1ZW5jZSk7Cgl2ZWN0b3I8ZG91YmxlPiB2MjsKCWJvb2wgaCA9IHRydWUsIGwgPSB0cnVlOwoJZm9yIChpbnQgaSA9IDA7IGkgPCBzaXplX29mX3RoZV9zZXF1ZW5jZTsgaSsrKQoJewoJCWNpbiA+PiB2MVtpXTsKCQlpZiAoaSAlIDQgPT0gMCkgdGVtcCsrOwoJfQoJZm9yIChpbnQgaSA9IDE7IGkgPCBzaXplX29mX3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