#include<bits/stdc++.h>
using namespace std;
#define sz 10010
#define MOD 1000000007
#define ll long long

bool check(vector<vector<int>>&a)
{
    for (int i = 0; i < 3; i++)
    {
        for (int j = 0; j < 3; j++)
        {
            int ans = 0;
            for (int x = i; x < i + 2; x++)
            {
                for (int y = j; y < j + 2; y++)
                {
                    ans += a[x][y];
                }
            }
            if (ans % 2 == 0)
                return 0;
        }
    }
    return 1;
}

int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);
    vector<vector<int>>mat = {{0, 0, 0, 0},
        {0, 0, 0, 0},
        {0, 0, 0, 0},
        {0, 0, 0, 0}
    };

    set<vector<vector<int>>>ans;
    
    for (int a = 0; a < 16; a++)
    {
        for (int b = 0; b < 16; b++)
        {
            for (int c = 0; c < 16; c++)
            {
                for (int d = 0; d < 16; d++)
                {
                    mat[0][0] = (a >> 0) & 1;
                    mat[0][1] = (a >> 1) & 1;
                    mat[0][2] = (a >> 2) & 1;
                    mat[0][3] = (a >> 3) & 1;

                    mat[1][0] = (b >> 0) & 1;
                    mat[1][1] = (b >> 1) & 1;
                    mat[1][2] = (b >> 2) & 1;
                    mat[1][3] = (b >> 3) & 1;

                    mat[2][0] = (c >> 0) & 1;
                    mat[2][1] = (c >> 1) & 1;
                    mat[2][2] = (c >> 2) & 1;
                    mat[2][3] = (c >> 3) & 1;

                    mat[3][0] = (d >> 0) & 1;
                    mat[3][1] = (d >> 1) & 1;
                    mat[3][2] = (d >> 2) & 1;
                    mat[3][3] = (d >> 3) & 1;

                    if (check(mat))
                    {
                        ans.insert(mat);
                    }
                }
            }
        }
    }

    cout << ans.size() << endl;
    for (auto M : ans)
    {
        int v = 0;
        for (auto it : M)
        {
            for (auto it2 : it)
            {
                v += it2;
                cout << it2 << " ";
            }
            cout << endl;
        }
        // THIS LINE CONFIRMS THAT NONE OF THE ANSWERS HAVE
        // AN ODD NUMBER OF ONES
        assert(v % 2 == 0);
        cout << endl;
    }
    return 0;
}