#include <fstream>
using namespace std;
int main()
{
    ifstream f1("timmax.inp");
    ofstream f2("timmax.out");
    int i;
    f1 >> i;
    int a[i];
    for (int j = 0; j < i; j++)
    {
        f1 >> a[j];
    }
    f1.close();
    int sln;
    sln = a[0];
    for (int n = 1; n < i; n++)
    {
        if (sln < a[n]) sln = a[n];
    }
    f2 << sln << endl;
    for (int m = 0; m < i; m++)
    {
        if (sln == a[m]) f2 << m+1 << " ";
    }
    f2.close();
    return 0;
}
