Problem: You are given an integer array of length n.

You have to choose some subsequence of this array of maximum length such that this subsequence forms a increasing sequence of consecutive integers. In other words the required sequence should be equal to [x, x + 1, ..., x + k - 1] for some value x and length k.

Subsequence of an array can be obtained by erasing some (possibly zero) elements from the array. You can erase any elements, not necessarily going successively. The remaining elements preserve their order. For example, for the array [5, 3, 1, 2, 4] the following arrays are subsequences: [3], [5, 3, 1, 2, 4], [5, 1, 4], but the array [1, 3] is not.

Input

The first line of the input containing integer number n (1 ≤ n ≤ 2 ⋅ 10^5) — the length of the array. The second line of the input containing n integer numbers a_1, a_2, ..., a_n (1 ≤ a_i ≤ 10^9) — the array itself.

Output

On the first line print k — the maximum length of the subsequence of the given array that forms an increasing sequence of consecutive integers.

On the second line print the sequence of the indices of the any maximum length subsequence of the given array that forms an increasing sequence of consecutive integers.

Examples

Input

7
3 3 4 7 5 6 8


Output

4
2 3 5 6 


Input

6
1 3 5 2 4 6


Output

2
1 4 


Input

4
10 9 8 7


Output

1
1 


Input

9
6 7 8 3 4 5 9 10 11


Output

6
1 2 3 7 8 9 

Note

All valid answers for the first example (as sequences of indices): 

  * [1, 3, 5, 6] 
  * [2, 3, 5, 6] 



All valid answers for the second example: 

  * [1, 4] 
  * [2, 5] 
  * [3, 6] 



All valid answers for the third example: 

  * [1] 
  * [2] 
  * [3] 
  * [4] 



All valid answers for the fourth example: 

  * [1, 2, 3, 7, 8, 9] 

Solution (in JAVA):

Solution:
import java.util.*;
import java.io.*;
import java.math.*;

public class Main {

    final static int mod = 1000000007;
    static FastReader sc;
    static PrintWriter out;
    static boolean test_case_input = false;

    public static void solution(int test_case) throws IOException {
        // code
        int n = sc.nextInt();
        int a[] = sc.intarr(n);
        Map<Integer, Integer> length = new HashMap<>();
        Map<Integer, Integer> position = new HashMap<>();
        int parent[] = new int[n];
        Arrays.fill(parent, -1);
        for (int i = 0; i < n; i++) {
            int newlength = length.getOrDefault(a[i] - 1, 0) + 1;
            if(newlength > length.getOrDefault(a[i], 0)) {
                length.put(a[i], newlength);
                parent[i] = position.getOrDefault(a[i] - 1, -1);
                position.put(a[i], i);
            }
        }
        int max_length = 0, val = 0;
        for(Map.Entry<Integer, Integer> entry : length.entrySet()) {
            if(entry.getValue() > max_length) {
                max_length = entry.getValue();
                val = position.get(entry.getKey());
            }
        }
        out.println(max_length);
        ArrayList<Integer> ans = new ArrayList<>();
        while(val != -1) {
            ans.add(val);
            val = parent[val];
        }
        for(int i = ans.size() - 1; i >= 0; i--) {
            out.print((ans.get(i) + 1) + " ");
        }
        out.println();
    }

    // log A base B
    public static int logint(int x, int base) {
        return (int) (Math.log(x) / Math.log(base));
    }

    public static int logint(long x, long base) {
        return (int) (Math.log(x) / Math.log(base));
    }

    public static int logint(double x, double base) {
        return (int) (Math.log(x) / Math.log(base));
    }

    public static double logdouble(int x, int base) {
        return (Math.log(x) / Math.log(base));
    }

    public static double logdouble(long x, long base) {
        return (Math.log(x) / Math.log(base));
    }

    public static double logdouble(double x, double base) {
        return (Math.log(x) / Math.log(base));
    }

    public static long loglong(int x, int base) {
        return (long) (Math.log(x) / Math.log(base));
    }

    public static long loglong(long x, long base) {
        return (long) (Math.log(x) / Math.log(base));
    }

    public static long loglong(double x, double base) {
        return (long) (Math.log(x) / Math.log(base));
    }

    // Debug
    public static void debug(String msg, Object value) {
        File output = new File("output.txt");
        if (!output.exists()) return;
        String type = value.getClass().getSimpleName();
        if (type.equals("int[]")) out.println(msg + " => " + Arrays.toString((int[]) value));
        else if (type.equals("double[]")) out.println(msg + " => " + Arrays.toString((double[]) value));
        else if (type.equals("float[]")) out.println(msg + " => " + Arrays.toString((float[]) value));
        else if (type.equals("long[]")) out.println(msg + " => " + Arrays.toString((long[]) value));
        else if (type.equals("char[]")) out.println(msg + " => " + Arrays.toString((char[]) value));
        else if (type.equals("String[]")) out.println(msg + " => " + Arrays.toString((String[]) value));
        else if (type.equals("int[][]")) {
            out.println(msg + "=>");
            for (int i[] : (int[][]) value)
                out.println(" . " + Arrays.toString(i).replace(' ', '\t'));
        } else if (type.equals("double[][]")) {
            out.println(msg + "=>");
            for (double i[] : (double[][]) value)
                out.println(" . " + Arrays.toString(i).replace(' ', '\t'));
        } else if (type.equals("float[][]")) {
            out.println(msg + "=>");
            for (float i[] : (float[][]) value)
                out.println(" . " + Arrays.toString(i).replace(' ', '\t'));
        } else if (type.equals("long[][]")) {
            out.println(msg + "=>");
            for (long i[] : (long[][]) value)
                out.println(" . " + Arrays.toString(i).replace(' ', '\t'));
        } else if (type.equals("char[][]")) {
            out.println(msg + "=>");
            for (char i[] : (char[][]) value)
                out.println(" . " + Arrays.toString(i).replace(' ', '\t'));
        } else if (type.equals("String[][]")) {
            out.println(msg + "=>");
            for (String i[] : (String[][]) value)
                out.println(" . " + Arrays.toString(i).replace(' ', '\t'));
        } else out.println(msg + " => " + value);
    }

    public static void debug(Object value) {
        File output = new File("output.txt");
        if (!output.exists()) return;
        String type = value.getClass().getSimpleName();
        if (type.equals("int[]")) out.println(" => " + Arrays.toString((int[]) value));
        else if (type.equals("double[]")) out.println(" => " + Arrays.toString((double[]) value));
        else if (type.equals("float[]")) out.println(" => " + Arrays.toString((float[]) value));
        else if (type.equals("long[]")) out.println(" => " + Arrays.toString((long[]) value));
        else if (type.equals("char[]")) out.println(" => " + Arrays.toString((char[]) value));
        else if (type.equals("String[]")) out.println(" => " + Arrays.toString((String[]) value));
        else if (type.equals("int[][]")) {
            out.println("=>");
            for (int i[] : (int[][]) value)
                out.println(" . " + Arrays.toString(i).replace(' ', '\t'));
        } else if (type.equals("double[][]")) {
            out.println("=>");
            for (double i[] : (double[][]) value)
                out.println(" . " + Arrays.toString(i).replace(' ', '\t'));
        } else if (type.equals("float[][]")) {
            out.println("=>");
            for (float i[] : (float[][]) value)
                out.println(" . " + Arrays.toString(i).replace(' ', '\t'));
        } else if (type.equals("long[][]")) {
            out.println("=>");
            for (long i[] : (long[][]) value)
                out.println(" . " + Arrays.toString(i).replace(' ', '\t'));
        } else if (type.equals("char[][]")) {
            out.println("=>");
            for (char i[] : (char[][]) value)
                out.println(" . " + Arrays.toString(i).replace(' ', '\t'));
        } else if (type.equals("String[][]")) {
            out.println("=>");
            for (String i[] : (String[][]) value)
                out.println(" . " + Arrays.toString(i).replace(' ', '\t'));
        } else out.println(" => " + value);
    }

    // Graph Functions
    public static void addUndirectedEdge(ArrayList<ArrayList<Integer>> adj, int u, int v) {
        adj.get(u).add(v);
        adj.get(v).add(u);
    }

    public static void addDirectedEdge(ArrayList<ArrayList<Integer>> adj, int u, int v) {
        adj.get(u).add(v);
    }

    public static <T> void addUndirectedEdge(ArrayList<ArrayList<Point>> adj, int u, int v, T weight) {
        adj.get(u).add(new Point(v, weight));
        adj.get(v).add(new Point(u, weight));
    }

    public static <T> void addDirectedEdge(ArrayList<ArrayList<Point>> adj, int u, int v, T weight) {
        adj.get(u).add(new Point(v, weight));
    }

    public static <T> void toString(String msg, ArrayList<ArrayList<T>> adj) {
        out.println(msg + ":");
        int count = 0;
        for (ArrayList<T> i : adj) {
            out.print("\t" + count++ + ": ");
            for (T j : i) {
                out.print(j + " ");
            }
            out.println();
        }
    }

    public static void addUndirectedEdge(Map<Integer, ArrayList<Integer>> adj, int u, int v) {
        if (adj.containsKey(u)) {
            ArrayList<Integer> temp = adj.get(u);
            temp.add(v);
            adj.put(u, temp);
        } else {
            ArrayList<Integer> temp = new ArrayList<>();
            temp.add(v);
            adj.put(u, temp);
        }
        if (adj.containsKey(v)) {
            ArrayList<Integer> temp = adj.get(v);
            temp.add(u);
            adj.put(v, temp);
        } else {
            ArrayList<Integer> temp = new ArrayList<>();
            temp.add(u);
            adj.put(v, temp);
        }
    }

    public static void addDirectedEdge(Map<Integer, ArrayList<Integer>> adj, int u, int v) {
        if (adj.containsKey(u)) {
            ArrayList<Integer> temp = adj.get(u);
            temp.add(v);
            adj.put(u, temp);
        } else {
            ArrayList<Integer> temp = new ArrayList<>();
            temp.add(v);
            adj.put(u, temp);
        }
    }

    public static <T> void addUndirectedEdge(Map<Integer, ArrayList<Point>> adj, int u, int v, T weight) {
        if (adj.containsKey(u)) {
            ArrayList<Point> temp = adj.get(u);
            temp.add(new Point(v, weight));
            adj.put(u, temp);
        } else {
            ArrayList<Point> temp = new ArrayList<>();
            temp.add(new Point(v, weight));
            adj.put(u, temp);
        }
        if (adj.containsKey(v)) {
            ArrayList<Point> temp = adj.get(v);
            temp.add(new Point(u, weight));
            adj.put(v, temp);
        } else {
            ArrayList<Point> temp = new ArrayList<>();
            temp.add(new Point(u, weight));
            adj.put(v, temp);
        }
    }

    public static <T> void addDirectedEdge(Map<Integer, ArrayList<Point>> adj, int u, int v, T weight) {
        if (adj.containsKey(u)) {
            ArrayList<Point> temp = adj.get(u);
            temp.add(new Point(v, weight));
            adj.put(u, temp);
        } else {
            ArrayList<Point> temp = new ArrayList<>();
            temp.add(new Point(v, weight));
            adj.put(u, temp);
        }
    }

    public static <T> void toString(String msg, Map<T, ArrayList<T>> adj) {
        out.println(msg + ":");
        for (Map.Entry<T, ArrayList<T>> entry : adj.entrySet()) {
            out.println("\t" + entry.getKey() + ": " + entry.getValue());
        }
    }

    // GCD
    public static int __gcd(int a, int b) {
        BigInteger n1 = BigInteger.valueOf(a);
        BigInteger n2 = BigInteger.valueOf(b);
        BigInteger gcd = n1.gcd(n2);
        return gcd.intValue();
    }

    public static long __gcd(long a, long b) {
        BigInteger n1 = BigInteger.valueOf(a);
        BigInteger n2 = BigInteger.valueOf(b);
        BigInteger gcd = n1.gcd(n2);
        return gcd.longValue();
    }

    public static void main(String args[]) throws IOException {
        long start = 0, end = 0;
        try {
            File output = new File("output.txt");
            sc = new FastReader();
            if (output.exists()) {
                out = new PrintWriter(new FileOutputStream("output.txt"));
                start = System.nanoTime();
            } else {
                out = new PrintWriter(System.out);
            }

            int test_cases = 1;
            if (test_case_input) test_cases = sc.nextInt();
            for (int i = 1; i <= test_cases; i++) {
                solution(i);
            }
            if (output.exists()) {
                end = System.nanoTime();
                out.println("Execution time: " + (end - start) / 1000000 + " ms");
            }
            out.flush();
            out.close();
        } catch (Exception e) {
            out.println("Exception: " + e);
            out.println("At Line no. : " + e.getStackTrace()[0].getLineNumber());
            out.flush();
            out.close();
            return;
        }
    }

    // Edge Class
    static class Edge implements Comparable<Edge> {
        Object u;
        Object v;
        Object wt;

        public Edge(Object origin, Object destination, Object weight) {
            u = origin;
            v = destination;
            wt = weight;
        }

        public String toString() {
            String ans = u + " -> " + v + " : " + wt;
            return ans;
        }

        public int getIntOrigin() {
            return (int) u;
        }

        public int getIntDestination() {
            return (int) v;
        }

        public int getIntWeight() {
            return (int) wt;
        }

        public long getLongOrigin() {
            return (long) u;
        }

        public long getLongDestination() {
            return (long) v;
        }

        public long getLongWeight() {
            return (long) wt;
        }

        @Override
        public int compareTo(Edge edge) {
            if ((edge.u).getClass() == Long.class) return (((Long) this.wt).compareTo((Long) edge.wt));
            else return (((Integer) this.wt).compareTo((Integer) edge.wt));
        }
    }

    // Point Class
    static class Point implements Comparable<Point> {
        Object x;
        Object y;

        public Point(Object a, Object b) {
            x = a;
            y = b;
        }

        public int getIntX() {
            return (int) x;
        }

        public int getIntY() {
            return (int) y;
        }

        public long getLongX() {
            return (long) x;
        }

        public long getLongY() {
            return (long) y;
        }

        public int compareTo(Point obj) {
            if (obj.x.equals(this.x)) {
                if ((obj.y).getClass() == Long.class) return ((Long) this.y).compareTo((Long) obj.y);
                else return ((Integer) this.y).compareTo((Integer) obj.y);
            } else {
                if ((obj.x).getClass() == Long.class) return ((Long) this.x).compareTo((Long) obj.x);
                else return ((Integer) this.x).compareTo((Integer) obj.x);
            }
        }

        public String toString() {
            String ans = "(" + x + ", " + y + ")";
            return ans;
        }

        @Override
        public int hashCode() {
            int hash = 7;
            hash = 71 * hash + (int) this.x;
            hash = 71 * hash + (int) this.y;
            return hash;
        }

        @Override
        public boolean equals(Object obj) {
            if (obj == null) return false;
            Point point = (Point) obj;
            if (point.x.equals(this.x) && point.y.equals(this.y)) return true;
            else return false;
        }
    }

    // Fast IO
    static class FastReader {
        BufferedReader br;
        StringTokenizer st;

        public FastReader() throws FileNotFoundException {
            File in = new File("input.txt");
            if (in.exists()) {
                br = new BufferedReader(new InputStreamReader(new FileInputStream("input.txt")));
            } else {
                br = new BufferedReader(new InputStreamReader(System.in));
            }
        }

        String next() {
            while (st == null || !st.hasMoreElements()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        int nextInt() {
            return Integer.parseInt(next());
        }

        float nextFloat() {
            return Float.parseFloat(next());
        }

        long nextLong() {
            return Long.parseLong(next());
        }

        double nextDouble() {
            return Double.parseDouble(next());
        }

        int[] intarr(int n) {
            int a[] = new int[n];
            for (int i = 0; i < n; i++) {
                a[i] = Integer.parseInt(next());
            }
            return a;
        }

        long[] longarr(int n) {
            long a[] = new long[n];
            for (int i = 0; i < n; i++) {
                a[i] = Long.parseLong(next());
            }
            return a;
        }

        float[] floatarr(int n) {
            float a[] = new float[n];
            for (int i = 0; i < n; i++) {
                a[i] = Float.parseFloat(next());
            }
            return a;
        }

        double[] doublearr(int n) {
            double a[] = new double[n];
            for (int i = 0; i < n; i++) {
                a[i] = Double.parseDouble(next());
            }
            return a;
        }


        int[][] intmatrix(int row, int col) {
            int a[][] = new int[row][col];
            for (int i = 0; i < row; i++) {
                for (int j = 0; j < col; j++) {
                    a[i][j] = Integer.parseInt(next());
                }
            }
            return a;
        }

        long[][] longmatrix(int row, int col) {
            long a[][] = new long[row][col];
            for (int i = 0; i < row; i++) {
                for (int j = 0; j < col; j++) {
                    a[i][j] = Long.parseLong(next());
                }
            }
            return a;
        }

        float[][] floatmatrix(int row, int col) {
            float a[][] = new float[row][col];
            for (int i = 0; i < row; i++) {
                for (int j = 0; j < col; j++) {
                    a[i][j] = Float.parseFloat(next());
                }
            }
            return a;
        }

        double[][] doublematrix(int row, int col) {
            double a[][] = new double[row][col];
            for (int i = 0; i < row; i++) {
                for (int j = 0; j < col; j++) {
                    a[i][j] = Double.parseDouble(next());
                }
            }
            return a;
        }

        String nextLine() {
            String str = "";
            try {
                str = br.readLine();
            } catch (IOException e) {
                e.printStackTrace();
            }
            return str;
        }
    }
}