#include <bits/stdc++.h>
using namespace std;
template <typename T>
istream& operator>>(istream& is, vector<T>& a) {
  for (T& ai : a) is >> ai;
  return is;
}
template <typename T>
ostream& operator<<(ostream& os, vector<T> const& a) {
  os << "[ ";
  for (const T& ai : a) os << ai << " ";
  return os << "]";
}
template <typename T1, typename T2>
istream& operator>>(istream& is, pair<T1, T2>& a) {
  return is >> a.first >> a.second;
}
template <typename T1, typename T2>
ostream& operator<<(ostream& os, pair<T1, T2> const& a) {
  return os << "(" << a.first << ", " << a.second << ")";
}
void f() {
  int n;
  cin >> n;
  vector<int> a(n), aa(n);
  cin >> a;
  for (int i = 0; i < n; ++i) aa[i] = i;
  sort((aa).begin(), (aa).end(), [&a](int x, int y) { return a[x] > a[y]; });
  vector<string> r(n + 1, string(n, '0'));
  for (int i = 0; i < n; ++i) {
    int j = aa[i];
    for (int k = 0; k < a[j]; ++k) {
      r[(i + k) % (n + 1)][j] = '1';
    }
  }
  cout << n + 1 << "\n";
  for (const string& ri : r) cout << ri << "\n";
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  f();
  return 0;
}
