#include using namespace std; #define dbg(x) (cout<<#x<<" = "<<(x)<<'\n') typedef long long int lld; const int INF = (1LL << 30) - 1; const lld LINF = (1LL << 62) - 1; const int NMAX = 4 * 1e5; int N; vector V[NMAX + 5]; vector> P; int main() { cin.sync_with_stdio(false); #ifndef ONLINE_JUDGE freopen("input.txt", "r", stdin); freopen("output.txt", "w", stdout); #endif scanf("%d", &N); for (int i = 1, x; i <= N; i++) { scanf("%d", &x); x %= N; V[x].push_back(i); if (!x) return 0 * printf("1\n%d\n", i); } for (int i = 0; i < N; i++) if (!V[i].empty() && !V[N - i].empty() && 2 * i != N) return 0 * printf("2\n%d %d\n", V[i].back(), V[N - i].back()); else if (2 * i == N && V[i].size() > 1) return 0 * printf("2\n%d %d\n", V[i].back(), V[N - i][0]); int ok = 1; for (int i = 1; i < N; i++) if (V[i].empty()) {ok = 0; break;} if (ok) { printf("%d\n", N); for (int i = 1; i <= N; i++) printf("%d ", i); return 0; } for (int i = 1; i < N; i++) { if (N % i == 0 && (int)V[i].size() >= N / i) { printf("%d\n", N / i); for (int j = 0; j < N / i; j++) printf("%d ", V[i][j]); return 0; } } for (int i = 1; i < N; i++) P.push_back(make_pair(V[i].size(), i)); sort(P.rbegin(), P.rend()); int bla = 0; for (auto pp : P) { ++bla; int p = pp.second; if (bla >= 10) break; for (int i = 0; i < (int)V[p].size(); i++) { int q = N - (1LL * (i + 1) * p) % N; if (!V[q].empty()) { printf("%d\n", i + 1); printf("%d ", V[q].back()); for (int j = 0; j <= i; j++) printf("%d ", V[p][j]); return 0; } } } return 0; }