#include <bits/stdc++.h>
using namespace std;
template <typename T>
vector<T>& operator--(vector<T>& v) {
  for (auto& i : v) --i;
  return v;
}
template <typename T>
vector<T>& operator++(vector<T>& v) {
  for (auto& i : v) ++i;
  return v;
}
template <typename T>
istream& operator>>(istream& is, vector<T>& v) {
  for (auto& i : v) is >> i;
  return is;
}
template <typename T>
ostream& operator<<(ostream& os, vector<T>& v) {
  for (auto& i : v) os << i << ' ';
  return os;
}
template <typename T, typename U>
istream& operator>>(istream& is, pair<T, U>& p) {
  is >> p.first >> p.second;
  return is;
}
template <typename T, typename U>
ostream& operator<<(ostream& os, pair<T, U>& p) {
  os << p.first << ' ' << p.second;
  return os;
}
template <typename T, typename U>
pair<T, U> operator-(pair<T, U> a, pair<T, U> b) {
  return make_pair(a.first - b.first, a.second - b.second);
}
template <typename T, typename U>
pair<T, U> operator+(pair<T, U> a, pair<T, U> b) {
  return make_pair(a.first + b.first, a.second + b.second);
}
template <typename T, typename U>
void umin(T& a, U b) {
  if (a > b) a = b;
}
template <typename T, typename U>
void umax(T& a, U b) {
  if (a < b) a = b;
}
int main() {
  int n;
  cin >> n;
  vector<int> a(n);
  cin >> a;
  vector<string> ans(n + 1, string(n, '0'));
  vector<vector<int>> groups(1);
  for (int i = 0; i < n + 1; ++i) {
    groups[0].push_back(i);
  }
  for (int i = 0; i < n; ++i) {
    vector<int> szs;
    for (int j = 0; j < groups.size(); ++j) {
      szs.push_back(groups[j].size());
    }
    int l = 0, r = n + 10;
    while (r - l > 1) {
      int c = (l + r) / 2;
      bool ok = true;
      int ul = 0, ur = 0;
      for (auto u : szs) {
        if (u <= c) {
          ur += u;
          continue;
        }
        if (u > c * 2) {
          ok = false;
          break;
        }
        ul += u - c;
        ur += c;
      }
      if (ul <= a[i] && a[i] <= ur) {
      } else {
        ok = false;
      }
      if (ok) {
        r = c;
      } else {
        l = c;
      }
    }
    42;
    ;
    vector<int> where(groups.size(), 0);
    vector<int> can(groups.size(), 0);
    int left = a[i];
    for (int i = 0; i < groups.size(); ++i) {
      if (groups[i].size() > r) {
        where[i] += (int)groups[i].size() - r;
        left -= (int)groups[i].size() - r;
        can[i] = r;
      } else {
        can[i] = groups[i].size();
      }
    }
    assert(left >= 0);
    42;
    ;
    for (int i = 0; i < groups.size(); ++i) {
      if (left == 0) break;
      int to_add = can[i] - where[i];
      if (true) {
        to_add = groups[i].size() - where[i];
        to_add /= 2;
      }
      if (to_add > left) to_add = left;
      where[i] += to_add;
      left -= to_add;
    }
    reverse(groups.begin(), groups.end());
    reverse(where.begin(), where.end());
    reverse(can.begin(), can.end());
    42;
    ;
    for (int i = 0; i < groups.size(); ++i) {
      if (left == 0) break;
      int to_add = can[i] - where[i];
      if (to_add > left) to_add = left;
      where[i] += to_add;
      left -= to_add;
    }
    42;
    ;
    assert(left == 0);
    int y = groups.size();
    for (int j = 0; j < y; ++j) {
      if (where[j] == 0) continue;
      if (where[j] == groups[j].size()) {
        for (auto k : groups[j]) {
          ans[k][i] = '1';
        }
        continue;
      }
      groups.emplace_back();
      for (int u = 0; u < where[j]; ++u) {
        ans[groups[j].back()][i] = '1';
        groups.back().push_back(groups[j].back());
        groups[j].pop_back();
      }
    }
    sort(groups.begin(), groups.end(),
         [&](vector<int>& a, vector<int>& b) { return a.size() > b.size(); });
  }
  cout << n + 1 << '\n';
  for (auto s : ans) {
    cout << s << '\n';
  }
  return 0;
}
