#include <iostream>
#include <fstream>
#include <cmath>
using namespace std;
int main()
{
    ifstream fi("timmax.inp");
    long int n;
    long int dem=0,s=0;
    long int mx;
    fi>>n;
    long int a[n];
    for (int i=0;i<n;i++)
        fi>>a[i];
    mx=a[0];
    for (int i=1;i<n;i++)
    {
        if (mx<a[i])
            {
                mx=a[i];
            }
    }
    fi.close();
    ofstream fo("timmax.out");
    fo<<mx<<endl;
    for (int i=0;i<=n-1;i++)
    {
        if(a[i]==mx)
        {
            fo<<i+1<<' ';
        }
    }
    return 0;
}
