#include <bits/stdc++.h>
using namespace std;
int soch(int a) {
  if (a == 3) return 1;
  return soch(a - 1) * a / (a - 3);
}
int main() {
  int n, num, i, j, k, raz, dob, num1, dob1, sum = 0, flag = 0, flag1 = 0;
  bool graf[105][105];
  bool graf1[6][6];
  vector<pair<int, int>> ver;
  vector<int> v;
  vector<int> v1;
  vector<int> v2;
  cin >> k;
  for (i = 1; i <= 100; i++)
    for (j = 1; j <= 100; j++) graf[i][j] = 0;
  for (i = 3; i <= 100; i++) {
    v2.push_back(soch(i));
    if (soch(i) > k) break;
  }
  num = i - 1;
  raz = k - soch(num);
  v.push_back(0);
  v.push_back(1);
  for (i = 3; i <= num; i++) v.push_back(soch(i + 1) - soch(i));
  for (i = 0; i < v.size(); i++)
    if (v[i] > raz) {
      dob = i - 1;
      break;
    };
  raz -= v[dob];
  dob++;
  k = raz;
  if (k) {
    flag1 = 1;
    for (i = 3; i <= 100; i++)
      if (soch(i) > k) break;
    num1 = i - 1;
    raz = k - soch(num1);
    for (i = 0; i < v.size(); i++)
      if (v[i] > raz) {
        dob1 = i - 1;
        break;
      };
    raz -= v[dob1];
    dob1++;
    k = raz;
  }
  if (k == 3) {
    flag = 1;
    v1.push_back(5);
    for (i = 1; i <= 5; i++)
      for (j = 1; j <= 5; j++)
        if (i != j)
          graf1[i][j] = 1;
        else
          graf1[i][j] = 0;
    graf1[1][3] = graf1[3][1] = graf1[1][4] = graf1[4][1] = graf1[4][3] =
        graf1[3][4] = 0;
  }
  if (!flag)
    for (i = v2.size() - 1; k > 0; i--)
      while (v2[i] <= k) {
        k -= v2[i];
        v1.push_back(i + 3);
      }
  for (i = 0; i < v1.size(); i++) sum += v1[i];
  if (!flag1) num1 = dob1 = 0;
  n = num + num1 + sum + 1 + flag1;
  cout << n << endl;
  for (i = 1; i <= num; i++)
    for (j = 1; j <= num; j++)
      if (i != j) graf[i][j] = 1;
  for (j = 1; j <= dob; j++) graf[num + 1][j] = graf[j][num + 1] = 1;
  if (flag1) {
    for (i = num + 2; i <= num + num1 + 1; i++)
      for (j = num + 2; j <= num + num1 + 1; j++)
        if (i != j) graf[i][j] = 1;
    for (j = num + 2; j <= dob1 + num + 1; j++)
      graf[num + num1 + 2][j] = graf[j][num + num1 + 2] = 1;
    num = num + num1 + 1;
  }
  if (!flag) {
    raz = 2;
    for (k = 0; k < v1.size(); k++) {
      for (i = num + raz; i <= num + raz + v1[k] - 1; i++)
        for (j = num + raz; j <= num + raz + v1[k] - 1; j++)
          if (i != j) graf[i][j] = 1;
      raz += v1[k];
    }
  } else {
    for (i = 0; i < 5; i++)
      for (j = 0; j < 5; j++)
        graf[num + 2 + i][num + 2 + j] = graf1[i + 1][j + 1];
  }
  for (i = 1; i <= n; i++) {
    for (j = 1; j <= n; j++) cout << graf[i][j];
    cout << endl;
  }
  return 0;
}
