#include <bits/stdc++.h>
const int INF = 1e9;
const int MOD = 1e9+7;
const long long LINF = 1e18;
#define FOR(i,a,b) for(ll i=(a);i<(b);++i)
#define rep(i,n) for(ll i=0;i<(n);++i)
#define REPR(i,n) for(ll i=n;i>=0;i--)
#define FOREACH(x,a) for(auto& (x) : (a) )
typedef long long ll;
using namespace std;
typedef pair<ll, ll> P;

template<typename T>
void print(const vector<T> &x) {
    int n = x.size();
    rep(i,n) {
        cout << x[i];
        if (i!=n-1) cout<<" ";
        else cout << endl;
    }
}

template<typename T>
void print(const vector<vector<T>> &x) {
    int n = x.size();
    rep(i,n) {
        rep(j,x[i].size()) {
            cout << x[i][j] << " ";
        }
        cout << endl;
    }
}

template<typename T>
void print(const vector<T> &x, int n) {
    rep(i,n) {
        cout << x[i];
        if (i!=n-1) cout<<" ";
        else cout << endl;
    }
}

template<typename T>
void print(const vector<vector<T>> &x, int n, int m) {
    rep(i,n) {
        rep(j,m) {
            cout << x[i][j] << " ";
        }
        cout << endl;
    }
}

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

void input_init() {
    cin.tie(0); ios::sync_with_stdio(false);
}

int main(int argc, char const *argv[]) {
    int n; cin>>n;
    vector<P> a(n);
    rep(i,n) {
        string s; cin>>s;
        int sum = 0;
        int mini = INF;
        for (auto &&e: s) {
            if (e == '(') sum++;
            else sum--;
            chmin(mini, sum);
        }
        a[i].first = mini;
        a[i].second = sum;
    }

    auto print = [&]() {
        for (auto &&e: a) cout << e.first << ", " << e.second << '\n';
    };

    vector<P> ans;
    sort(a.begin(), a.end(), greater<>());
    for (auto &&e: a) {
        if (e.second >= 0) {
            ans.push_back(e);
        }
    }

    sort(a.begin(), a.end(), [](const P &l, const P &r) {
        return l.second-l.first > r.second-r.first;
    });

    for (auto&&e: a) {
        if (e.second < 0) {
            ans.push_back(e);
        }
    }

    P c;
    bool ok = true;
    for (auto &&e: ans) {
       if (c.second+e.first < 0) ok = false;
       c.second += e.second;
    }
    
    if (c.second != 0) ok = false;

    if (ok) {
        cout << "Yes" << '\n';
    }
    else {
        cout << "No" << '\n';
    }
    return 0;
}

#include <iostream>
#include <complex>
#include <vector>
#include <string>
#include <algorithm>
#include <cstdio>
#include <numeric>
#include <cstring>
#include <ctime>
#include <cstdlib>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <list>
#include <cmath>
#include <bitset>
#include <cassert>
#include <queue>
#include <stack>
#include <deque>
#include <random>
#include <iomanip>
#define rep(i,n) for(int i=0;i<n;i++)
using namespace std;
typedef long long int ll;
typedef long double ld;
typedef pair<ll,ll> P;
const ll MOD=1000000007;
const ll MAX_N=500010;
const ll INF=999999999999;

int main(){
    int n;
    cin>>n; 
    vector<int> a(n);
    for(int i=0;i<n;i++){
        cin>>a[i];
    }
    vector<int> b(n,0);
    int ans=0;
    for(int i=n-1;i>=0;i--){
        int now=i+1;
        int widt=now;
        int num=0;
        for(;now<=n;now+=widt){
            num+=b[now-1];
        }
        if(num%2==a[i]){
            b[i]=0;
        }else{
            b[i]=1;
            ans++;
        }
    }
    cout<<ans<<endl;
    for(int i=0;i<b.size();i++){
        if(b[i]) cout<<i+1<<" ";
    }
    cout<<endl;

}