#include <bits/stdc++.h>

using namespace std;
int main()
{
    //freopen ( "timmax.inp","r",stdin);
    //freopen ( "timmax.out","w",stdout);
    long n,d,z; cin>>n; long a[10000]; d=0; int e=0;
    for ( long b=0; b<=n-1; b++)
        {
                cin>>a[b];
        }
    long max=a[0];
    for (long c=0; c<n; c++)
    if (a[c]>max) {max=a[c];  z=c;}
    cout << max<<endl;
    for (long f=0; f<n;f++)
    if (a[f]==max) cout<< f+1<< " ";
 
}

