#include <iostream>
#include <set>
using namespace std;
pair<int,int> P[40005];
int V,rez[40005];
int j,k,ok,col,tmp,N,i;
int main()
{
    cin>>N;
    for(i=1;i<=N;i++)
    {
        cin>>V;
        V%=N;
        for(j=0;j<N;j++)
        {
            if(j<V)
            {
                if(P[j-V+N].second&&!P[j].second)
                    P[j]=make_pair(i,j-V+N);
            }
            else if(j>V)
            {
                if(P[j-V].second&&!P[j].second)
                    P[j]=make_pair(i,j-V);
            }
        }
        if(!P[V].second)
            P[V]=make_pair(i,-1);
        if(P[0].second)
            break;
    }
    i=0;
    while(i>=0)
    {
        rez[++rez[0]]=P[i].first;
        i=P[i].second;
    }
    cout<<rez[0]<<"\n";
    for(i=rez[0];i>0;i--)
        cout<<rez[i]<<" ";
    return 0;
}