#include <stdio.h>

T(n)
{
   int i=0, j, x=1,d=0;
   while(x<=n) x+=x,++d; // count the digits
   // each binary digit is approximately 0.3 decimal digit
   // this approximation is accurate enough for the task
   for(;i<=n;i++)
     for(j=0;j<=n;j++)
       printf("%*d%c",
              d*3/10+1,
              i^j,
              j < n ? 32:10); // space between columns, newline at end
}

int main(void) {
	// your code goes here
	int n=9;
	scanf("%d", &n);
	T(n);
	return 0;
}
