#include <iostream>
#include <fstream>
using namespace std;
int main ()
{

ifstream f("timmax.inp");
int N,max;
f>>N;
ofstream f1("timmax.out");
 int a[10001];
max=0;
for (int i=1; i<=N; i++)
{
f>>a[i];
if (a[i]>max) max = a[i];
}
f.close();
f1<<max<<endl;
for (int i=1;i<=N;i++)
{
if (a[i] == max) f1<<i<<" ";
}
f1.close();
return 0;
}
