//I still luv you Kashish <3
#include <bits/stdc++.h>
using namespace std ;
#define int                             long long
#define pb                              push_back
#define F                               first
#define S                               second
#define P                               push
#define nl                              "\n"
#define vvi                             vector<vector<int>>
#define vi                              vector<int>
#define vc                              vector<char>
#define pii                             vector<pair<int, int>>
#define sz(a)                           (int)a.size()
#define all(a)                          a.begin(),a.end()
#define sort(v)                         sort(all(v))
#define sortr(v)                        sort(v); reverse(all(v));
#define yes                             cout << "YES"
#define no                              cout << "NO"
#define PeeleMera                       ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
int binpow(int a, int b)                { int res = 1; while (b > 0) { if (b & 1) res = res * a; a = a * a; b >>= 1; } return res;}
int binpowmod(int a, int b, int mod)    { int res = 1; while (b > 0) { if (b & 1) res = res * a , res = res % mod ; a = a * a , a = a % mod ; b >>= 1 ; } return res % mod; }
vi  sieve(int n)                        {int*arr = new int[n + 1](); vi vect; for(int i=2;i<=n;i++)if(arr[i]==0){vect.push_back(i);for(int j=2*i;j<=n;j+=i)arr[j]=1;}return vect;}
// void bin(int n)                         {/* vi v; define karna na bhoole */ if (n > 1)bin(n / 2);v.pb(n%2);}
mt19937                                 rng(chrono::steady_clock::now().time_since_epoch().count());
#define Peele_Mera                             cerr<<"Time : "<<1000*(long double)clock()/(long double)CLOCKS_PER_SEC<<"ms\n";
const int                               N = 1e9 + 7 , N1 = 1e7 + 5 , N2 = 1e6 + 3, N3 = 1e5 + 3;
#define IM                              -1e18
#define IX                              1e18


void solve()
{
    int n;
    cin>>n;
    for(int i=0;i<1e5;i++)
    {
        if(i*(i+1)/2>=n)
        {
            cout<<i;
            break;
        }
    }
}


signed main()
{
    PeeleMera;
    #ifndef ONLINE_JUDGE    
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    #endif
    int t=1;
    // cin>>t;./
    // cout<<fixed<<setprecision(9);

    while(t--)
    {
        solve();
        cout<<endl;
    }
    Peele_Mera;
}
#include <iostream>
using namespace std;
bool chek[200001];
int main()
{
    ios::sync_with_stdio(false);
    cin.tie(NULL);
    int n;
    cin >> n;
    int ret = 0, temp;
    for (int i = 0; i < n; i++) {
        cin >> temp;
        chek[temp] = true;
        while (chek[ret])ret++;
        if (i) cout << "\n";
        cout << ret;
    }
    return 0;
}