#include <bits/stdc++.h>   const int MAXN = 200000;   using namespace std;   inline int read() {     int x = 0, w = 1;     char c =    ;     while (c <  0  || c >  9 ) {       c = getchar();       if (c ==  - ) w = -1;     }     while (c >=  0  && c <=  9 ) {       x = (x << 1) + (x << 3) + (c ^ 48);       c = getchar();     }     return x * w;   }   int n, a[MAXN + 5];   void init() {     n = read();     for (int i = 1; i <= n; ++i) a[i] = read();   }   int mx, mxi, ans[MAXN + 5], len;   map<int, int> dp;   int main() {     init();     for (int i = 1; i <= n; ++i) {       dp[a[i]] = dp[a[i] - 1] + 1;       if (dp[a[i]] > mx) {         mx = dp[a[i]];         mxi = a[i];       }     }     printf( %d n , mx);     for (int i = n; i > 0; --i)       if (mxi == a[i]) {         --mxi;         ans[++len] = i;       }     for (int i = len; i > 0; --i) printf( %d  , ans[i]);     printf(  n );     return 0;   }   