#include #include #include using namespace std; const int NMAX = 400000 + 2; map suma; vector sol; int n; int v[NMAX]; void citeste() { cin >> n; for (int i = 1; i <= n; i++) { cin >> v[i]; v[i] %= n; } } void gaseste_sol(int x) { int ant = suma[x]; sol.push_back(ant); if (v[ant] == x) return; int next = (x - v[ant] + n) % n; gaseste_sol(next); } void scrie() { gaseste_sol(0); cout << sol.size() << '\n'; for (int i = 0; i < (int)sol.size(); i++) cout << sol[i] << ' '; cout << '\n'; } void rezolva() { int aux; for (int i = 1; i <= n; i++) { map :: iterator it; suma[v[i]] = i; for (it = suma.begin(); it != suma.end(); it++) { if ((*it).second == i) continue; aux = ((*it).first + v[i]) % n; if (suma[aux]) continue; suma[aux] = i; } if (suma[0]) { scrie(); return; } } } int main() { citeste(); rezolva(); return 0; }