#include <bits/stdc++.h>
using namespace std;
const int MAXN = 4444444;
const int MAXM = 256;
const int INF = 1e9 + 7;
bool dig[MAXM], good[MAXM];
int kd[MAXM], digt[MAXM][MAXM], mask[MAXM], q[MAXM];
int ans[4][MAXN];
int main() {
  int n, all = 0;
  cin >> n;
  int x;
  for (int i = 0; i < n; i++) {
    cin >> x;
    dig[x] = 1;
    all |= (1 << x);
  }
  if (n > 6) {
    cout << 0 << endl;
    return 0;
  }
  int kg = 0;
  for (int i = 0; i < MAXM; i++) {
    good[i] = 1;
    mask[i] = 0;
    kd[i] = 0;
    x = i;
    while (x) {
      digt[i][kd[i]++] = x % 10;
      if (!dig[x % 10]) good[i] = 0;
      mask[i] |= (1 << (x % 10));
      x /= 10;
    }
    if (i == 0) {
      if (!dig[0]) good[i] = 0;
      digt[i][kd[i]++] = 0;
      mask[i] |= (1 << 0);
    }
  }
  int cnt = 0;
  for (int a = 0; a < MAXM; a++)
    if (good[a])
      for (int b = 0; b < MAXM; b++)
        if (good[b])
          for (int c = 0; c < MAXM; c++)
            if (good[c]) {
              if ((mask[a] | mask[b] | mask[c]) != all) continue;
              for (int d = 0; d < MAXM; d++)
                if (good[d]) {
                  int u = 0;
                  for (int i = kd[a] - 1; i >= 0; i--) q[u++] = digt[a][i];
                  for (int i = kd[b] - 1; i >= 0; i--) q[u++] = digt[b][i];
                  for (int i = kd[c] - 1; i >= 0; i--) q[u++] = digt[c][i];
                  for (int i = kd[d] - 1; i >= 0; i--) q[u++] = digt[d][i];
                  bool ok = 1;
                  for (int i = 0; i < u - i - 1; i++)
                    if (q[i] != q[u - i - 1]) {
                      ok = 0;
                      break;
                    }
                  if (ok) {
                    ans[0][cnt] = a;
                    ans[1][cnt] = b;
                    ans[2][cnt] = c;
                    ans[3][cnt] = d;
                    cnt++;
                  }
                }
            }
  cout << cnt << endl;
  for (int i = 0; i < cnt; i++)
    for (int j = 0; j < 4; j++) {
      cout << ans[j][i];
      if (j == 3)
        cout << endl;
      else
        cout << '.';
    }
  return 0;
}
