#include <bits/stdc++.h>
using namespace std;
char buf[1 << 21], *p1 = buf, *p2 = buf;
template <class T>
void read(T &x) {
  x = 0;
  int c = getchar();
  int flag = 0;
  while (c < '0' || c > '9') flag |= (c == '-'), c = getchar();
  while (c >= '0' && c <= '9')
    x = (x << 3) + (x << 1) + (c ^ 48), c = getchar();
  if (flag) x = -x;
}
template <class T>
T _max(T a, T b) {
  return b < a ? a : b;
}
template <class T>
T _min(T a, T b) {
  return a < b ? a : b;
}
template <class T>
bool checkmax(T &a, T b) {
  return a < b ? a = b, 1 : 0;
}
template <class T>
bool checkmin(T &a, T b) {
  return b < a ? a = b, 1 : 0;
}
int k, m;
int K[105], C[105];
int a[106][106];
void init() {
  read(k);
  m = k;
  for (int i = 1; i <= 100; ++i)
    K[i] = i * (i - 1) * (i - 2) / 6, C[i] = i * (i - 1) / 2;
}
void solve() {
  int F = 0;
  for (int i = 1; i <= 100; ++i)
    if (K[i] <= k) F = i;
  for (int i = 1; i < F; ++i)
    for (int j = i + 1; j <= F; ++j) a[i][j] = a[j][i] = 1;
  k -= K[F];
  int n = F;
  if (k) {
    for (n = F + 1;; ++n) {
      int p = 0;
      for (int j = 2; j <= F; ++j) {
        if (C[j] <= k) p = j;
      }
      k -= C[p];
      for (int j = 1; j <= p; ++j) a[n][j] = a[j][n] = 1;
      if (!k) break;
    }
  }
  int hcy = 0;
  for (int i = 1; i <= n; ++i) {
    for (int j = i + 1; j <= n; ++j) {
      for (int k = j + 1; k <= n; ++k) {
        if (a[i][j] && a[i][k] && a[j][k]) ++hcy;
      }
    }
  }
  assert(hcy == m);
  printf("%d\n", n);
  for (int i = 1; i <= n; ++i) {
    for (int j = 1; j <= n; ++j) {
      printf("%d", a[i][j]);
    }
    printf("\n");
  }
}
int main() {
  init();
  solve();
  return 0;
}
