#include<iostream>
using namespace std;
int main() {
int n, v[51], min = 101;
cin >> n;
for (int i = 1; i <= n; i++) {
cin >> v[i];
if (v[i] < min && v[i] > 0)
min = v[i];
}
for (int i = 1; i <= n; i++)
if (v[i] < 0)
v[i] = min;
for (int i = 1; i <= n; i++)
cout << v[i] << ' ';
return 0;
}