#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
const ld eps = 1e-8;
template <class U, class V>
ostream& operator<<(ostream& out, const pair<U, V>& p) {
  return out << "(" << p.first << ", " << p.second << ")";
}
template <size_t i, class T>
ostream& print_tuple_utils(ostream& out, const T& tup) {
  if constexpr (i == tuple_size<T>::value)
    return out << ")";
  else
    return print_tuple_utils<i + 1, T>(out << (i ? ", " : "(") << get<i>(tup),
                                       tup);
}
template <class... U>
ostream& operator<<(ostream& out, const tuple<U...>& tup) {
  return print_tuple_utils<0, tuple<U...>>(out, tup);
}
template <class Con, class = decltype(begin(declval<Con>()))>
typename enable_if<!is_same<Con, string>::value, ostream&>::type operator<<(
    ostream& out, const Con& container) {
  out << "{";
  for (auto it = container.begin(); it != container.end(); ++it)
    out << (it == container.begin() ? "" : ", ") << *it;
  return out << "}";
}
const int maxn = 1010;
int n;
int a[maxn];
vector<int> spos;
list<vector<bool>> solve(int len) {
  if (!len) {
    return {};
  }
  int dec_pos = len - 2;
  for (; dec_pos >= 0 and a[spos[dec_pos]] == 1; --dec_pos)
    ;
  ++dec_pos;
  list<vector<bool>> ans;
  ans.emplace_back();
  for (int i = (int)(0); i < (int)(dec_pos); ++i) {
    --a[spos[i]];
    ans.back().push_back(1);
  }
  for (int i = (int)(dec_pos); i < (int)(len - 1); ++i) ans.back().push_back(0);
  --a[spos[len - 1]];
  ans.back().push_back(1);
  auto rest = solve(len - 1);
  int& last = a[spos[len - 1]];
  if (rest.size()) {
    rest.front().push_back(0);
    for (auto it = ++rest.begin(); it != rest.end(); ++it) {
      it->push_back(!!last);
      if (last) --last;
    }
  }
  if (last) {
    while (last--) {
      rest.emplace_back(len);
      rest.back().back() = 1;
    }
  }
  ans.splice(ans.end(), rest);
  return ans;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cin >> n;
  for (int i = (int)(0); i < (int)(n); ++i) cin >> a[i];
  spos.resize(n);
  for (int i = (int)(0); i < (int)(n); ++i) spos[i] = i;
  sort((spos).begin(), (spos).end(), [](int u, int v) { return a[u] > a[v]; });
  vector<int> rev_pos(n);
  for (int i = (int)(0); i < (int)(n); ++i) rev_pos[spos[i]] = i;
  auto ans = solve(n);
  cout << ((int)ans.size()) << '\n';
  for (auto& row : ans) {
    for (int i = (int)(0); i < (int)(n); ++i) cout << row[rev_pos[i]];
    cout << '\n';
  }
  return 0;
}
