#include <bits/stdc++.h>

#define rep(i, n) for (int i = 0; i < (n); ++i)

using namespace std;

using ll = long long;
using P = pair<int, int>;

int main() {
  int n;
  cin >> n;
  vector<int> a(n + 1);
  rep(i, n) cin >> a.at(i + 1);
  vector<int> b(n + 1, 0);
  for (int i = n; i >= 1; i--) {
    int sum = 0;
    for (int j = i + i; j <= n; j += i) {
      sum += b.at(j);
    }
    if (a.at(i) == 1) {
      if (sum % 2 == 1) {
        b.at(i) = 0;
      } else {
        b.at(i) = 1;
      }
    } else {
      if (sum % 2 == 1) {
        b.at(i) = 1;
      } else {
        b.at(i) = 0;
      }
    }
  }
  vector<int> res;
  for (int i = 1; i <= n; i++) {
    if (b.at(i) == 1) {
      res.push_back(i);
    }
  }
  cout << res.size() << endl;
  rep(i, res.size()) {
    if (i != 0) {
      cout << " ";
    }
    cout << res.at(i);
  }
  cout << endl;
  return 0;
}

#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define pi 3.141592653589793238
#define fast ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define mod 1000000007
void solve()
{
	ll n;
	cin>>n;
	vector<ll> x(n);
	for(ll i=0;i<n;i++)
		cin>>x[i];
	sort(x.begin(),x.end());
	ll a=0,b=0,c=0;
	for(ll i=n-1;i>=0;i--)
	{
		if(x[i]==x[i-1])
		{
			// cout<<x[i];
			a=x[i];
			c=i-1;
			break;
		}
	}
	// cout<<c<<a;
	for(ll i=c-1;i>=0;i--)
	{
		if(x[i]==x[i-1])
		{
			b=x[i];
			break;
		}
	}
	cout<<a*b;
	return;
}


int main()
{
	fast;
	ll q;
	q=1;
	// cin>>q;
	while(q--)
	{
		solve();
	}
	return 0;
}
