#include <bits/stdc++.h>
using namespace std;
int N;
int s[111];
int d[111];
int dels[111], finaldel;
void print2(int a, int b) {
  for (int(i) = 1; (i) <= (N); (i)++) {
    if (i == a || i == b) {
      cout << '1';
    } else
      cout << '0';
  }
  cout << endl;
}
void print22() {
  int a, b;
  int maxdd = -1;
  for (int(i) = 1; (i) <= (N); (i)++) {
    if (dels[i] >= maxdd) {
      a = i, maxdd = dels[i];
    }
  }
  maxdd = -1;
  for (int(i) = 1; (i) <= (N); (i)++) {
    if (i != a && dels[i] >= maxdd) {
      b = i, maxdd = dels[i];
    }
  }
  dels[a]--, dels[b]--;
  for (int(i) = 1; (i) <= (N); (i)++) {
    if (i == a || i == b) {
      cout << '1';
    } else
      cout << '0';
  }
  cout << endl;
}
void print33() {
  int a, b, c;
  int maxdd = -1;
  for (int(i) = 1; (i) <= (N); (i)++) {
    if (dels[i] >= maxdd) {
      a = i, maxdd = dels[i];
    }
  }
  maxdd = -1;
  for (int(i) = 1; (i) <= (N); (i)++) {
    if (i != a && dels[i] >= maxdd) {
      b = i, maxdd = dels[i];
    }
  }
  maxdd = -1;
  for (int(i) = 1; (i) <= (N); (i)++) {
    if (i != a && i != b && dels[i] >= maxdd) {
      c = i, maxdd = dels[i];
    }
  }
  dels[a]--, dels[b]--, dels[c]--;
  for (int(i) = 1; (i) <= (N); (i)++) {
    if (i == a || i == b || i == c) {
      cout << '1';
    } else
      cout << '0';
  }
  cout << endl;
}
int main() {
  cin >> N;
  for (int(i) = 1; (i) <= (N); (i)++) cin >> s[i];
  int maxs = -1, mins = 111;
  for (int(i) = 1; (i) <= (N); (i)++) {
    maxs = max(maxs, s[i]);
    mins = min(mins, s[i]);
  }
  int maxd = maxs - mins;
  int sumd = 0;
  for (int(i) = 1; (i) <= (N); (i)++) {
    sumd += s[i] - mins;
  }
  if (sumd == 1) {
    mins--;
    maxd = maxs - mins;
    sumd = 0;
    for (int(i) = 1; (i) <= (N); (i)++) {
      sumd += maxd - s[i];
    }
  }
  sumd -= maxd;
  finaldel = mins;
  while (sumd < maxd && finaldel > 0) {
    finaldel--;
    maxd += 1;
    sumd += N - 1;
  }
  int full = 0;
  if (finaldel <= 0) {
    finaldel = 0;
    cout << 0 << endl;
    for (int(i) = 1; (i) <= (N); (i)++) {
      dels[i] = s[i] - finaldel;
      full += dels[i];
    }
    cout << full << endl;
    for (int(i) = 1; (i) <= (N); (i)++) {
      for (int(j) = 1; (j) <= (dels[i]); (j)++)
        if (i == 1) {
          print2(i, 2);
        } else {
          print2(i, 1);
        }
    }
  } else {
    cout << finaldel << endl;
    for (int(i) = 1; (i) <= (N); (i)++) {
      dels[i] = s[i] - finaldel;
      full += dels[i];
    }
    cout << full / 2 << endl;
    int t = full / 2;
    for (int(k) = 1; (k) <= (t); (k)++) {
      int a[3], tt = 0;
      if (full == 3) {
        print33();
      } else {
        print22();
      }
      full -= 2;
    }
  }
  return 0;
}
