#include <bits/stdc++.h>
#define INT long
#define oo 987654321
#define OO 9999999987654321
#define MOD 998244353
using namespace std;

INT n, a[1030], b[1027][1030];

int main()
{
    ios::sync_with_stdio(false);
    srand(time(NULL));
    cin>>n;
    freopen(".10.in","w",stdout);
    cout<<n<<endl;
    for(int i = 1 ; i <= (1<<n) ; i++)
    {
        for(int j = 1 ; j <= (1<<n) ; j++ )
            cout<<(rand()%10)<<" ";
        cout<<endl;
    }
}
