#include #include using namespace std; pair 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;jV) { 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<0;i--) cout<