#include <bits/stdc++.h>
using namespace std;
inline int in() {
  int x;
  scanf("%d", &x);
  return x;
}
const int INF = 1001001001;
int main() {
  int n = in();
  vector<pair<int, int> > a(n);
  for (int i = 0; i < n; ++i)
    cin >> a[i].first, a[i].first *= -1, a[i].second = i;
  vector<string> s;
  while (1) {
    sort(a.begin(), a.end());
    if (a[0].first == a.back().first) break;
    if (n >= 3 && a[0].first == a[1].first && a[0].first == a[2].first) {
      if (a[3].first == a[0].first + 1 && a.back().first == a[0].first + 1) {
        string t(n, '0');
        t[a[0].second] = t[a[1].second] = t[a[2].second] = '1';
        a[0].first++;
        a[1].first++;
        a[2].first++;
        s.push_back(t);
        continue;
      }
    }
    string t(n, '0');
    t[a[0].second] = t[a[1].second] = '1';
    s.push_back(t);
    a[0].first++;
    if (a[1].first) a[1].first++;
  }
  cout << -a[0].first << endl;
  cout << int(s.size()) << endl;
  for (int i = 0; i < int(s.size()); ++i) cout << s[i] << endl;
  return 0;
}
