#include #include #include using namespace std; const int NMAX = 400000 + 2; map suma; int suma2[NMAX]; 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 = suma2[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); int l = (int) sol.size(); cout << l << '\n'; for (int i = 0; i < l; ++i) cout << sol[i] << ' '; cout << '\n'; } void rezolva() { int aux, val; map :: iterator it; for (int i = 1; i <= n; ++i) { val = v[i]; if (val == 0) { cout << "1\n" << i << '\n'; return; } if (!suma[val]) { suma[val] = i; suma2[val] = i; } for (it = suma.begin(); it != suma.end(); ++it) { if ((*it).second == i) continue; aux = ((*it).first + val) % n; if (suma2[aux]) continue; suma[aux] = i; suma2[aux] = i; } if (suma2[0]) { scrie(); return; } } } int main() { citeste(); rezolva(); return 0; }