Răspuns :
#include <bits/stdc++.h>
using namespace std;
int main()
{
multiset<int, greater<int>> S;
int n;
cin >> n;
for(int i = 1, x; i <= n; i++) {
cin >> x;
if(x <= n && ~x & 1) S.insert(x);
}
for(multiset<int, greater<int>>::iterator it = S.begin(); it != S.end(); ++it)
cout << *it << ' ';
}
using namespace std;
int main()
{
multiset<int, greater<int>> S;
int n;
cin >> n;
for(int i = 1, x; i <= n; i++) {
cin >> x;
if(x <= n && ~x & 1) S.insert(x);
}
for(multiset<int, greater<int>>::iterator it = S.begin(); it != S.end(); ++it)
cout << *it << ' ';
}