#include <bits/stdc++.h>
using namespace std;
int N;
string to_string(vector<int> v) {
  string ret(N, '0');
  for (int n : v) ret[n] = '1';
  return ret;
}
int main() {
  cin >> N;
  vector<vector<int>> v(N, vector<int>(2));
  for (int i = 0; i < N; i++) {
    scanf("%d", &v[i][0]);
    v[i][1] = i;
  }
  sort(v.begin(), v.end(), greater<vector<int>>());
  vector<string> ret;
  while (v.front()[0] != v.back()[0]) {
    if (3 < N && v[0][0] == v[2][0] && v[3][0] == v.back()[0] &&
        v.back()[0] + 1 == v.front()[0]) {
      ret.push_back(to_string({v[0][1], v[1][1], v[2][1]}));
      v[0][0]--;
      break;
    }
    v[0][0] = max(0, v[0][0] - 1);
    v[1][0] = max(0, v[1][0] - 1);
    ret.push_back(to_string({v[0][1], v[1][1]}));
    sort(v.begin(), v.end(), greater<vector<int>>());
  }
  cout << v[0][0] << "\n" << ret.size() << "\n";
  for (string s : ret) {
    cout << s << "\n";
  }
  return 0;
}
