#include using namespace std; void solve() { int n; cin >> n; vector A(n); for(auto& v : A) cin >> v; int mx = *max_element(A.begin(), A.end()); int j = n - 1; for(int i = 1; i <= mx; ++i) { while(j >= 0 && A[j] < i) --j; cout << j + 1 << " "; } } int main() { ios_base::sync_with_stdio(0); cin.tie(0); int t = 1; //cin >> t; while(t--) solve(); }