#include <bits/stdc++.h>
using namespace std;
const int N = 200000 + 5;
int x[N];
map<int, int> a;
int main() {
  int n, maxn = 0, start;
  cin >> n;
  for (int i = 0; i < n; i++) {
    scanf("%d", &x[i]);
    a[x[i]] = a[x[i] - 1] + 1;
    if (a[x[i]] > maxn) {
      maxn = a[x[i]];
      start = x[i] - a[x[i]] + 1;
    }
  }
  cout << maxn << endl;
  for (int i = 0; i < n; i++) {
    if (x[i] == start) printf("%d ", i + 1), maxn--, start++;
    if (maxn == 0) return 0;
  }
}
