#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;
}
I2luY2x1ZGU8Yml0cy9zdGRjKysuaD4KdXNpbmcgbmFtZXNwYWNlIHN0ZDsKI2RlZmluZSBzeiAxMDAxMAojZGVmaW5lIE1PRCAxMDAwMDAwMDA3CiNkZWZpbmUgbGwgbG9uZyBsb25nCgpib29sIGNoZWNrKHZlY3Rvcjx2ZWN0b3I8aW50Pj4mYSkKewogICAgZm9yIChpbnQgaSA9IDA7IGkgPCAzOyBpKyspCiAgICB7CiAgICAgICAgZm9yIChpbnQgaiA9IDA7IGogPCAzOyBqKyspCiAgICAgICAgewogICAgICAgICAgICBpbnQgYW5zID0gMDsKICAgICAgICAgICAgZm9yIChpbnQgeCA9IGk7IHggPCBpICsgMjsgeCsrKQogICAgICAgICAgICB7CiAgICAgICAgICAgICAgICBmb3IgKGludCB5ID0gajsgeSA8IGogKyAyOyB5KyspCiAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgYW5zICs9IGFbeF1beV07CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgIH0KICAgICAgICAgICAgaWYgKGFucyAlIDIgPT0gMCkKICAgICAgICAgICAgICAgIHJldHVybiAwOwogICAgICAgIH0KICAgIH0KICAgIHJldHVybiAxOwp9CgppbnQgbWFpbigpCnsKICAgIGlvczo6c3luY193aXRoX3N0ZGlvKDApOwogICAgY2luLnRpZSgwKTsgY291dC50aWUoMCk7CiAgICB2ZWN0b3I8dmVjdG9yPGludD4+bWF0ID0ge3swLCAwLCAwLCAwfSwKICAgICAgICB7MCwgMCwgMCwgMH0sCiAgICAgICAgezAsIDAsIDAsIDB9LAogICAgICAgIHswLCAwLCAwLCAwfQogICAgfTsKCiAgICBzZXQ8dmVjdG9yPHZlY3RvcjxpbnQ+Pj5hbnM7CiAgICAKICAgIGZvciAoaW50IGEgPSAwOyBhIDwgMTY7IGErKykKICAgIHsKICAgICAgICBmb3IgKGludCBiID0gMDsgYiA8IDE2OyBiKyspCiAgICAgICAgewogICAgICAgICAgICBmb3IgKGludCBjID0gMDsgYyA8IDE2OyBjKyspCiAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgIGZvciAoaW50IGQgPSAwOyBkIDwgMTY7IGQrKykKICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICBtYXRbMF1bMF0gPSAoYSA+PiAwKSAmIDE7CiAgICAgICAgICAgICAgICAgICAgbWF0WzBdWzFdID0gKGEgPj4gMSkgJiAxOwogICAgICAgICAgICAgICAgICAgIG1hdFswXVsyXSA9IChhID4+IDIpICYgMTsKICAgICAgICAgICAgICAgICAgICBtYXRbMF1bM10gPSAoYSA+PiAzKSAmIDE7CgogICAgICAgICAgICAgICAgICAgIG1hdFsxXVswXSA9IChiID4+IDApICYgMTsKICAgICAgICAgICAgICAgICAgICBtYXRbMV1bMV0gPSAoYiA+PiAxKSAmIDE7CiAgICAgICAgICAgICAgICAgICAgbWF0WzFdWzJdID0gKGIgPj4gMikgJiAxOwogICAgICAgICAgICAgICAgICAgIG1hdFsxXVszXSA9IChiID4+IDMpICYgMTsKCiAgICAgICAgICAgICAgICAgICAgbWF0WzJdWzBdID0gKGMgPj4gMCkgJiAxOwogICAgICAgICAgICAgICAgICAgIG1hdFsyXVsxXSA9IChjID4+IDEpICYgMTsKICAgICAgICAgICAgICAgICAgICBtYXRbMl1bMl0gPSAoYyA+PiAyKSAmIDE7CiAgICAgICAgICAgICAgICAgICAgbWF0WzJdWzNdID0gKGMgPj4gMykgJiAxOwoKICAgICAgICAgICAgICAgICAgICBtYXRbM11bMF0gPSAoZCA+PiAwKSAmIDE7CiAgICAgICAgICAgICAgICAgICAgbWF0WzNdWzFdID0gKGQgPj4gMSkgJiAxOwogICAgICAgICAgICAgICAgICAgIG1hdFszXVsyXSA9IChkID4+IDIpICYgMTsKICAgICAgICAgICAgICAgICAgICBtYXRbM11bM10gPSAoZCA+PiAzKSAmIDE7CgogICAgICAgICAgICAgICAgICAgIGlmIChjaGVjayhtYXQpKQogICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgYW5zLmluc2VydChtYXQpOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgfQogICAgICAgIH0KICAgIH0KCiAgICBjb3V0IDw8IGFucy5zaXplKCkgPDwgZW5kbDsKICAgIGZvciAoYXV0byBNIDogYW5zKQogICAgewogICAgICAgIGludCB2ID0gMDsKICAgICAgICBmb3IgKGF1dG8gaXQgOiBNKQogICAgICAgIHsKICAgICAgICAgICAgZm9yIChhdXRvIGl0MiA6IGl0KQogICAgICAgICAgICB7CiAgICAgICAgICAgICAgICB2ICs9IGl0MjsKICAgICAgICAgICAgICAgIGNvdXQgPDwgaXQyIDw8ICIgIjsKICAgICAgICAgICAgfQogICAgICAgICAgICBjb3V0IDw8IGVuZGw7CiAgICAgICAgfQogICAgICAgIC8vIFRISVMgTElORSBDT05GSVJNUyBUSEFUIE5PTkUgT0YgVEhFIEFOU1dFUlMgSEFWRQogICAgICAgIC8vIEFOIE9ERCBOVU1CRVIgT0YgT05FUwogICAgICAgIGFzc2VydCh2ICUgMiA9PSAwKTsKICAgICAgICBjb3V0IDw8IGVuZGw7CiAgICB9CiAgICByZXR1cm4gMDsKfQ==