#include <bits/stdc++.h>   using namespace std;   int n, a[300010], cnt, fa[300010], siz[300010], ans;   bool tag[300010];   inline int find(int x) {     while (x ^ fa[x]) x = fa[x] = fa[fa[x]];     return x;   }   inline void merge(int x, int y) {     x = find(x), y = find(y);     if (x ^ y) fa[x] = y, siz[y] += siz[x];   }   int main() {     printf( 1  );     scanf( %d , &n);     for (int i = 1; i <= n; i++) fa[i] = i, siz[i] = 1;     for (int i = 1; i <= n; i++) {       int p;       scanf( %d , &p);       if (a[p - 1]) {         merge(p, p - 1);       }       if (a[p + 1]) {         merge(p, p + 1);       }       a[p] = 1;       printf( %d  , a[n] ? i - siz[find(n)] + 1 : i + 1);     }     return 0;   }   