#include #include #include using namespace std; using namespace __gnu_pbds; #define ar array #define vt vector #define pq priority_queue #define pu push #define pub push_back #define em emplace #define emb emplace_back #define mt make_tuple #define all(x) x.begin(), x.end() #define allr(x) x.rbegin(), x.rend() #define allp(x, l, r) x.begin() + l, x.begin() + r #define len(x) (int)x.size() #define uniq(x) unique(all(x)), x.end() using ll = long long; using ld = long double; using ull = unsigned long long; template void re(array & x); template void re(vt & x); template void re(T& x) { cin >> x; } template void re(T& x, M&... args) { re(x), re(args...); } template void re(vt & x) { for(auto& it : x) re(it); } template void re(array & x) { for(auto& it : x) re(it); } template void wr(const array & x); template void wr(const vt & x); template void wr(const T& x) { cout << x; } template void wr(const T& x, const M&... args) { wr(x), wr(args...); } template void wr(const vt & x) { for(auto it : x) wr(it, ' '); } template void wr(const array & x) { for(auto it : x) wr(it, ' '); } template auto mvt(size_t n, M&&... args) { if constexpr(sizeof...(args) == 1) return vector(n, args...); else return vector(n, mvt(args...)); } void set_fixed(int p = 0) { cout << fixed << setprecision(p); } void set_scientific() { cout << scientific; } void Open(const string& name) { #ifndef ONLINE_JUDGE (void)!freopen((name + ".in").c_str(), "r", stdin); (void)!freopen((name + ".out").c_str(), "w", stdout); #endif } vt hookLength(vt hook) { vt hook_t(hook[0]); for (int i = 0; i < hook[0]; ++i) { int x = lower_bound(allr(hook), i + 1) - hook.rbegin(); hook_t[i] = len(hook) - x; } return hook_t; } void solve() { int n; re(n); vt hook(n); re(hook); wr(hookLength(hook)); } int main() { ios_base::sync_with_stdio(false); cin.tie(nullptr); //Open(""); int t = 1; for(;t;t--) { solve(); } return 0; }