#include<bits/stdc++.h>
using namespace std;
int a[400400],n;
bool b[400400];
int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	cin >> n >> a[1];
	a[1]%=n;
	if(a[1]%n == 0) return cout <<"1\n1",0;
	for(int i = 2; i <= n ; i++)
	{
		cin >> a[i];
		a[i] += a[i-1];
		a[i] %= n;
		if(a[i] == 0){
			cout << i << "\n";
			for(int j = 1; j <= i; j++) cout << j << " ";
			return 0;
		}
	}
	for(int i = 1; i <= n ; i++)
	{
		if(b[a[i]])
		{
			int j = i-1,k = 2;
			while(j >= 1 && a[j] != a[i])j--,k++;
			j++,k--;
			cout << k << "\n";
			for(;j<=i;j++)cout << j << " ";
			return 0;
		}else b[a[i]] = true;
	}
//	cout << "1";
}