//#line 2 "SubstringQueries.cpp"

#define _CRT_SECURE_NO_WARNINGS

#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <cstring>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <list>
#include <random>
#include <algorithm>
#include <functional>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>
#include <unordered_set>
#include <unordered_map>
#include <array>
#include <cassert>
#include <bitset>
#include <cstdint>
using namespace std;
using LL = long long;

int N;

int main() {
	cin >> N;
	if (N == 1) {
		cout << 1 << endl << 0 << endl;
		return 0;
	}
	if (N == 2) {
		cout << 2 << endl << 0 << endl << 11 << endl;
		return 0;
	}
	cout << N - 1 << endl;
	for (int i = 2; i <= N; ++i) {
		for (int j = 0; j < i; ++j) {
			if (j == 0 || j == i - 1) {
				cout << 0;
			}
			else {
				cout << 1;
			}
		}
		cout << endl;
	}
	return 0;
}
