import std.stdio;
import std.string;
import std.conv;
import std.typecons;
import std.algorithm;
import std.functional;
import std.bigint;
import std.numeric;
import std.array;
import std.math;
import std.range;
import std.container;

void main() {
    int N = readln.chomp.to!int;
    int[] x = readln.split.to!(int[]);
    int[] index = N.iota.map!(a=>a+1).array;
    int[][] divisors = new int[][N];
    foreach(int i; 0..N) divisors[i] = getDivisor(x[i]);
    sort!((a, b) => a[0]>b[0])(zip(x, index, divisors));
    int[][] ary;
    foreach(int i; 0..N) {
        int[] _ary = [index[i]];
        auto rbt = redBlackTree(divisors[i]);
        for(int j=i+1; j<N; j++) {
            if (rbt.equalRange(x[j]).empty) {
                _ary ~= index[j];
                rbt.insert(divisors[j]);
            }
        }
        ary ~= _ary;
    }
    int maxlength = 0;
    for (int i=0; i<ary.length; i++) {
        if (ary[i].length > maxlength) maxlength = ary[i].length;
    }
    ary.filter!(a => a.length==maxlength).array.sort.front.to!string.tr("[],", "", "d").writeln;
}
T[] getDivisor(T)(T n) {
    T[] result;
    for(T i=1; i*i<=n; i++) {
        if (n%i==0) result ~= [i, n/i];
    }
    return result.sort;
}