#include<fstream>
#include<vector>
using namespace std;
ifstream fi("timmax.inp");
ofstream fo("timmax.out");
int main(){
int n,ans,ans2=0;
fi>>n;
vector<int>a(n);
fi>>a[0];
ans=a[0];
for(int i=1;i<n;++i){
fi>>a[i];
ans=max(ans,a[i]);
}
fo<<ans<<endl;
for(int i=0;i<n;++i)if(ans==a[i])fo<<i+1<<' ';
}
