#include <bits/stdc++.h>
using namespace std;
long long dp[20005];
int main() {
  long long n;
  cin >> n;
  long long a[n];
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  map<long long, long long> dp;
  long long ans = -1;
  long long last;
  for (long long i = 0; i < n; i++) {
    long long x = a[i];
    dp[x] = dp[x - 1] + 1;
    if (dp[x] > ans) {
      ans = dp[x];
      last = x;
    }
  }
  vector<int> v;
  for (int i = n - 1; i >= 0; i--) {
    if (a[i] == last) {
      last--;
      v.push_back(i + 1);
    }
  }
  reverse(v.begin(), v.end());
  cout << v.size() << endl;
  for (int i = 0; i < v.size(); i++) {
    cout << v[i] << " ";
  }
  cout << endl;
  return 0;
}
