#include <fstream>
#include <iostream>
using namespace std;
int main()
{
    int n,a[10000],vt[10000],d = 0,mx = -2000000000;
    ifstream f1("timmax.inp");
    ofstream f2("timmax.out");
    f1>>n;
    //cin>>n;
    for (int i = 0; i < n ; i++)
    {
        f1>>a[i];
        //cin>>a[i];
    }
    for (int i = 0; i < n ; i++)
    {
        if (mx < a[i]) {mx = a[i]; d = 0;}
        if (a[i] == mx) {vt[d] = i+1; d++;}
    }
    f2<<mx<<endl;
    for (int i = 0; i < d ; i++)
    {
        f2<<vt[i]<<" ";
    }
    return 0;
}
