#undef DEBUG
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Numerics;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
using static System.Math;
using MethodImplAttribute = System.Runtime.CompilerServices.MethodImplAttribute;
using MethodImplOptions = System.Runtime.CompilerServices.MethodImplOptions;

public static class P
{
    static int n;
    static int[] p;
    static List<Operation> Operations = new List<Operation>();
    public static void Main()
    {
        n = int.Parse(Console.ReadLine());
        p = Console.ReadLine().Split().Select(int.Parse).ToArray();
        if (n % 2 == 1)
        {
            var ind = Array.IndexOf(p, n - 1);
            if (ind == n - 1) goto end;
            if (p.Last() % 2 == 0)
            {
                var op = new bool[n];
                op[n - 1] = true;
                op[Array.FindIndex(p, x => x % 2 == 1)] = true;
                //op 1
                ExecuteOperation(new Operation() { Kind = Kind.EvenOdd, tf = op });
            }
            { 
                var op = new bool[n];
                op[n - 1] = true;
                op[ind] = true;
                //op 2
                ExecuteOperation(new Operation() { Kind = Kind.OddEven, tf = op });
            }
        }end:;
        var half = n / 2;
        int[] final = new int[half * 2];
        //even init
        var normalEven = 0;
        var overEven = half % 2 == 0 ? half : half + 1;
        var normalOdd = 1;
        var overOdd = half % 2 == 1 ? half : half + 1;
        for (int i = 0; i < half; i++)
        {
            if (i % 2 == 0) final[i] = (normalEven += 2) - 2;
            else final[i] = (overEven += 2) - 2;
        }
        //odd init
        for (int i = half; i < half * 2; i++)
        {
            if (i % 2 == 0) final[i] = (normalOdd += 2) - 2;
            else final[i] = (overOdd += 2) - 2;
        }

        var numberToFinalIndex = new int[half * 2];
        for (int i = 0; i < final.Length; i++)
        {
            numberToFinalIndex[final[i]] = i;
        }

        //op 3
        var allOp = new Operation();
        {
            var op = new bool[n];
            for (int i = 0; i < half * 2; i++)
                op[i] = true;
            allOp = new Operation() { Kind = Kind.EvenOdd, tf = op };
            ExecuteOperation(allOp);
        }
        //op 4-29
        for (int i = 0; i < 13; i++)
        {
            var op = new bool[n];

            //even
            for (int j = 0; j < half; j++)
            {
                var relativeInd = numberToFinalIndex[p[j]];
                if ((relativeInd >> i & 1) == 1) op[j] = true;
            }
            //odd
            for (int j = half; j < half * 2; j++)
            {
                var relativeInd = 2 * half - 1 - numberToFinalIndex[p[j]];
                if ((relativeInd >> i & 1) == 1) op[j] = true; 
            }
            ExecuteOperation(new Operation()
            {
                Kind = Kind.OddEven,
                tf = op
            });
            ExecuteOperation(allOp);
        }
        //op 30
        {
            var op = new bool[n];
            for (int j = 0; j < half; j++)
            {
                if (j % 2 == 1) op[j] = true;
            }
            //odd
            for (int j = half; j < half * 2; j++)
            {
                if (j % 2 == 0) op[j] = true;
            }
            ExecuteOperation(new Operation()
            {
                Kind = Kind.OddEven,
                tf = op
            });
        }
        Console.WriteLine(Operations.Count);
        foreach (var item in Operations)
        {
            Console.WriteLine($"{(int)item.Kind} {string.Join("", item.tf.Select(x => x ? '1' : '0'))}");
        }
    }
    static void ExecuteOperation(Operation operation)
    {
#if DEBUG
        Console.WriteLine($"{(int)operation.Kind} {string.Join("", operation.tf.Select(x => x ? '1' : '0'))}");
#endif
        List<int> odd = new List<int>();
        List<int> even = new List<int>();
        Operations.Add(operation);
        for (int i = 0; i < n; i++)
        {
            if (!operation.tf[i]) continue;
            (p[i] % 2 == 0 ? even : odd).Add(p[i]);
        }
        var c = operation.Kind == Kind.OddEven ? odd.Concat(even) : even.Concat(odd);
        int ptr = 0;
        foreach (var item in c)
        {
            while (!operation.tf[ptr]) ptr++;
            p[ptr++] = item;
        }
#if DEBUG
        Console.WriteLine(string.Join(" ", p));
#endif  
    }
}

class Operation
{
    public Kind Kind;
    public bool[] tf;
}

enum Kind
{
    EvenOdd = 0,
    OddEven = 1
}



Measured memory_bytes: 33168