#include <bits/stdc++.h>
using namespace std;
template <typename T>
bool vmin(T& a, T b) {
  return (a > b) ? (a = b, true) : (false);
}
template <typename T>
bool vmax(T& a, T b) {
  return (a < b) ? (a = b, true) : (false);
}
template <typename T>
T smax(T x) {
  return x;
}
template <typename T, typename... K>
T smax(T a, const K&... args) {
  return max(a, smax(args...));
}
template <typename T>
T smin(T x) {
  return x;
}
template <typename T, typename... K>
T smin(T a, const K&... args) {
  return min(a, smin(args...));
}
template <typename A, typename B>
ostream& operator<<(ostream& os, const pair<A, B>& z) {
  os << "(" << z.first << ", " << z.second << ')';
  return os;
}
template <typename T>
ostream& operator<<(ostream& os, const vector<T>& a) {
  bool isfirst = true;
  os << "{";
  for (auto z : a) {
    if (!isfirst) {
      os << ", ";
    }
    os << z;
    isfirst = false;
  }
  os << '}';
  return os;
}
const int inf = (signed)(~0u >> 2);
const long long llf = (signed long long)(~0ull >> 2);
template <typename T>
int vsize(vector<T>& x) {
  return (signed)x.size();
}
template <typename T>
void discrete(T* a, int* b, int n) {
  vector<T> v(a + 1, a + n + 1);
  sort(v.begin(), v.end());
  for (int i = 1; i <= n; i++)
    b[i] = lower_bound(v.begin(), v.end(), a[i]) - v.begin() + 1;
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0), cout.tie(0);
  int n;
  cin >> n;
  vector<pair<int, int>> a(n);
  vector<int> b(n);
  for (int i = 0; i < n; i++) {
    cin >> a[i].first;
    a[i].second = i;
  }
  sort(a.begin(), a.end());
  for (int i = 0; i < n; i++) b[a[i].second] = i;
  vector<vector<char>> s(n + 1, vector<char>(n + 1, 0));
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < n; j++) {
      s[i][j] = (i != j) + '0';
    }
  }
  for (int i = 0; i < n; i++) s[n][i] = '1';
  for (int i = 0; i < n; i++) {
    int p = i + 1, r = n;
    while (r > a[i].first) {
      if (p > n) p -= n + 1;
      s[p++][i] = '0';
      r--;
    }
  }
  cout << n + 1 << '\n';
  vector<char> t(n + 1, 0);
  for (auto& v : s) {
    for (int i = 0; i < n; i++) t[i] = v[b[i]];
    cout << t.data() << '\n';
  }
  return 0;
}
