#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cassert>
#include<cmath>
#include<vector>
#include<map>
#include<set>
#include<string>
#include<queue>
#include<stack>
using namespace std;
#define MOD 1000000007
#define MOD2 998244353
#define INF ((1<<30)-1)
#define LINF (1LL<<60)
#define EPS (1e-10)
typedef long long Int;
typedef pair<Int, Int> P;

Int a[16000];
Int goal[16000];
Int n;
Int last = 0;

void show(){
    return;
    for(int i = 0;i < n;i++)cout << a[i] << " ";cout << endl;
    for(int i = 0;i < n;i++)cout << goal[a[i]] << " ";cout << endl;
}

void all(){
    cout << 0 << " ";
    for(int i = 0;i < n;i++){
        cout << 1;
    }
        if(last)cout << 0;
        cout << endl;
    vector<int> odd, even;
    for(int i = 0;i < n;i++){
        if(a[i] % 2 == 1)odd.push_back(a[i]);
        if(a[i] % 2 == 0)even.push_back(a[i]);
    }
    int p = 0;
    for(int i = 0;i < even.size();i++)a[p++] = even[i];
    for(int i = 0;i < odd.size();i++)a[p++] = odd[i];
    show();
}

void pivot(int k){
    cout << 1 << " ";
    vector<int> odd, even;
    vector<int> pos;
    for(int i = 0;i < n;i++){
        if(a[i] % 2 == 1 && (goal[a[i]] >> k) % 2 == 0){
            cout << 1;
            odd.push_back(a[i]);
            pos.push_back(i);
        }
        else if(a[i] % 2 == 0 && (goal[a[i]] >> k) % 2 == 1){
            cout << 1;
            even.push_back(a[i]);
            pos.push_back(i);
        }
        else cout << 0;
    }
    for(auto elem:even)odd.push_back(elem);
    for(int i = 0;i < pos.size();i++){
        a[pos[i]] = odd[i];
    }
    if(last)cout << 0;
    cout << endl;
    show();
    all();
}

void set_last(){
    if(a[n-1] == n-1){
        cout << 28 << endl;
        return;
    }
    int n_pos = 0;
    int one_pos = 0;
    while(a[n_pos] != n-1)n_pos++;
    while(a[one_pos] != 1)one_pos++;
    if(a[n-1] % 2 == 0){
        cout << 30 << endl;
        cout << 0 << " ";
        for(int i = 0;i < n;i++){
            if(i == one_pos || i == n-1)cout << 1;
            else cout << 0;
        }cout << endl;
        swap(a[n-1], a[one_pos]);       
    }
    else cout << 29 << endl;
    cout << 1 << " ";
    for(int i = 0;i < n;i++){
        if(i == n-1 || i == n_pos)cout << 1;
        else cout << 0;
    }
    cout << endl;
    swap(a[n_pos], a[n-1]);           
}

int main(){
    cin >> n;
    for(int i = 0;i < n;i++){
        cin >> a[i];
        goal[i] = i;
    }
    if(n == 1){cout << 0 << endl;return 0;}
    if(n % 2 == 1){
        set_last();
        show();
        n--;
        last = 1;
    }
    else{
        cout << 28 << endl;
    }
    int oddl = 1, evenr = n-2;
    while(oddl < evenr){
        oddl+=2;
        evenr-=2;
    }
    int swapmax = oddl;
    oddl = 1;
    evenr += 2;
    for(int i = 0;oddl + i * 2 < swapmax;i++){
        swap(goal[oddl + i * 2], goal[evenr + i * 2]);
    }
    int el = min(goal[1], goal[swapmax]);
    for(int i = 0;i < n;i++){
        if(goal[i] >= el){
            goal[i] -= el;
            goal[i] = (1 << 14) + goal[i] - el;
        }
    }

    all();
    for(int i = 0;i <= 12 ;i++)pivot(i);

    cout << 1 << " ";
    for(int i = 0;i < n + last;i++){
        if(a[i] != i)cout << 1;
        else cout << 0;
    }cout << endl;
    
    return 0;
}


Measured memory_bytes: 3536