#include<bits/stdc++.h>

int main(){
    using namespace std;
    unsigned long N;
    cin >> N;
    cout << 2 * (64 - __builtin_clzl(N - 1)) << endl;
    vector<unsigned long> ev, od;
    string S(N, '0');
    {
        vector<unsigned long> to(N), tr(N);
        iota(to.begin(), to.end(), 0UL);
        for(unsigned long i{1}, j{N / 2 + ((N & 3) != 0) + ((N & 3) == 1)}; j < N; i += 2, j += 2){
            swap(to[i], to[j]);
            S[i] = S[j] = '1';
        }
        for(unsigned long i{0}; 2 * i < N; ++i)tr[to[i]] = 2 * i;
        for(unsigned long i{0}; 2 * i + 1 < N; ++i)tr[to[N - 1 - i]] = 2 * i + 1 + (N & 1);
        for(unsigned long j{0}, i; j < N; ++j){
            cin >> i;
            if(i & 1)od.push_back(tr[i]);
            else ev.push_back(tr[i]);
        }
    }
    string sep(N + 5, '1');
    sep[0] = '0';
    sep[1] = sep.back() = ' ';
    sep[N + 2] = '\n';
    for(unsigned long i{2}; i < N; i <<= 1){
        string T(N, '0');
        vector<unsigned long> e1, e2, o1, o2;
        for(unsigned long j{0}; j < (N + 1) / 2; ++j)if(ev[j] & i){
            T[j] = '1';
            e2.push_back(ev[j]);
        }else{
            e1.push_back(ev[j]);
        }
        for(unsigned long j{0}; j < N / 2; ++j)if(od[j] & i){
            T[j + (N + 1) / 2] = '1';
            o1.push_back(od[j]);
        }else{
            o2.push_back(od[j]);
        }
        copy(e1.begin(), e1.end(), ev.begin());
        copy(e2.rbegin(), e2.rend(), ev.rbegin());
        copy(o1.begin(), o1.end(), od.begin());
        copy(o2.rbegin(), o2.rend(), od.rbegin());
        cout << sep << T << endl;
    }
    cout << sep << S << endl;
    return 0;
}
