import java.io.*;
import java.util.*;

public class parade_sm {

    void solve() {
        int n = in.nextInt();
        in.nextLine();
        assert 1 <= n && n <= 100000;
        int[] h = new int[n];
        for (int i = 0; i < h.length; i++) {
            h[i] = in.nextInt();
            assert 1 <= h[i] && h[i] <= 1e9;
        }
        int[] a = new int[n];
        int[] b = new int[n];
        int[] aArg = new int[n];
        int[] bArg = new int[n];
        a[0] = Integer.MAX_VALUE;
        b[0] = -1;
        aArg[0] = -1;
        bArg[0] = -1;
        for (int i = 1; i < n; i++) {
            a[i] = -1;
            aArg[i] = -1;
            b[i] = Integer.MAX_VALUE;
            bArg[i] = -1;
            if (h[i] > h[i - 1]) {
                a[i] = a[i - 1];
                aArg[i] = aArg[i - 1];
            }
            if (h[i] < h[i - 1]) {
                b[i] = b[i - 1];
                bArg[i] = bArg[i - 1];
            }
            if (h[i] > b[i - 1] && a[i] < h[i - 1]) {
                a[i] = h[i - 1];
                aArg[i] = i - 1;
            }
            if (h[i] < a[i - 1] && b[i] > h[i - 1]) {
                b[i] = h[i - 1];
                bArg[i] = i - 1;
            }
//            System.err.println("i = " + i + ", a = " + a[i] + ", b = " + b[i]);
        }

//        System.err.println(Arrays.toString(a));
//        System.err.println(Arrays.toString(aArg));
//        System.err.println(Arrays.toString(b));
//        System.err.println(Arrays.toString(bArg));
        ArrayList<Integer> ans = new ArrayList<Integer>();
        int x = n - 1;
        if (a[x] == -1 && b[x] == Integer.MAX_VALUE) {
            out.println("Impossible");
            return;
        }
        if (a[x] == -1) {
            x = bArg[x];
        }
        while (x >= 0) {
//            System.err.println("x = " + x);
            for (int j = x; j >= aArg[x] + 1; j--) {
                ans.add(j);
            }
            int y = aArg[x];
            if (y == -1) {
                break;
            }
            x = bArg[y];
        }
//        System.err.println(ans);
        if (ans.size() == 0) {
            ans.add(0);
        }
        if (ans.size() == n) {
            ans.remove(0);
        }
        out.println(ans.size());
        Collections.reverse(ans);
        for (int i : ans) {
            out.print((i + 1) + " ");
        }

    }

    Scanner in;
    PrintWriter out;

    void run() throws IOException {
        in = new Scanner(new File("parade.in"));
        out = new PrintWriter("parade.out");
        solve();
        out.close();
    }

    public static void main(String[] args) throws IOException {
        new parade_sm().run();
    }


//----------------- just for validation ------------------

    /**
     * Strict scanner to veryfy 100% correspondence between input files and input file format specification.
     * It is a drop-in replacement for {@link java.util.Scanner} that could be added to a soulution source
     * (cut-and-paste) without breaking its ability to work with {@link java.util.Scanner}.
     */
    private static class Scanner {
        private final BufferedReader in;
        private String line = "";
        private int pos;
        private int lineNo;
        private boolean localeset;

        public Scanner(File source) throws FileNotFoundException {
            in = new BufferedReader(new FileReader(source));
            nextLine();
        }

        public Scanner(InputStream inputStream) throws FileNotFoundException {
            in = new BufferedReader(new InputStreamReader(inputStream));
            nextLine();
        }

        public void close() {
            assert line == null : "Extra data at the end of file";
            try {
                in.close();
            } catch (IOException e) {
                throw new AssertionError("Failed to close with " + e);
            }
        }

        public void nextLine() {
            assert line != null : "EOF";
            assert pos == line.length() : "Extra characters on line " + lineNo;
            try {
                line = in.readLine();
            } catch (IOException e) {
                throw new AssertionError("Failed to read line with " + e);
            }
            pos = 0;
            lineNo++;
        }

        public String next() {
            assert line != null : "EOF";
            assert line.length() > 0 : "Empty line " + lineNo;
            if (pos == 0)
                assert line.charAt(0) > ' ' : "Line " + lineNo + " starts with whitespace";
            else {
                assert pos < line.length() : "Line " + lineNo + " is over";
                assert line.charAt(pos) == ' ' : "Wrong whitespace on line " + lineNo;
                pos++;
                assert pos < line.length() : "Line " + lineNo + " is over";
                assert line.charAt(0) > ' ' : "Line " + lineNo + " has double whitespace";
            }
            StringBuilder sb = new StringBuilder();
            while (pos < line.length() && line.charAt(pos) > ' ')
                sb.append(line.charAt(pos++));
            return sb.toString();
        }

        public int nextInt() {
            String s = next();
            assert s.length() == 1 || s.charAt(0) != '0' : "Extra leading zero in number " + s + " on line " + lineNo;
            assert s.charAt(0) != '+' : "Extra leading '+' in number " + s + " on line " + lineNo;
            try {
                return Integer.parseInt(s);
            } catch (NumberFormatException e) {
                throw new AssertionError("Malformed number " + s + " on line " + lineNo);
            }
        }

        public long nextLong() {
            String s = next();
            assert s.length() == 1 || s.charAt(0) != '0' : "Extra leading zero in number " + s + " on line " + lineNo;
            assert s.charAt(0) != '+' : "Extra leading '+' in number " + s + " on line " + lineNo;
            try {
                return Long.parseLong(s);
            } catch (NumberFormatException e) {
                throw new AssertionError("Malformed number " + s + " on line " + lineNo);
            }
        }

        public double nextDouble() {
            assert localeset : "Locale must be set with useLocale(Locale.US)";
            String s = next();
            assert s.length() == 1 || s.startsWith("0.") || s.charAt(0) != '0' : "Extra leading zero in number " + s + " on line " + lineNo;
            assert s.charAt(0) != '+' : "Extra leading '+' in number " + s + " on line " + lineNo;
            // at most two digits
            assert s.indexOf('.') < 0 || s.indexOf('.') >= s.length() - 3;
            try {
                return Double.parseDouble(s);
            } catch (NumberFormatException e) {
                throw new AssertionError("Malformed number " + s + " on line " + lineNo);
            }
        }

        public void useLocale(Locale locale) {
            assert locale == Locale.US;
            localeset = true;
        }
    }

}
