#include <bits/stdc++.h>
using namespace std;
bool b[500], good[500];
int c[500010], mask[500010], kd[500010];
int aw[500010], ai[500010], aj[500010], ak[500010];
int d[500][500];
int g[500010], q[500010];
int main() {
  int n, i, m, j, k, need = 0, a, x, y, w;
  cin >> n;
  for (i = 0; i < 10; i++) b[i] = false;
  for (i = 0; i < n; i++) {
    cin >> a;
    need |= (1 << a);
    b[a] = true;
  }
  if (n > 6) {
    cout << 0 << endl;
    return 0;
  }
  int kg = 0;
  for (i = 0; i < 256; i++) {
    good[i] = true;
    x = i;
    mask[i] = 0;
    kd[i] = 0;
    while (x > 0) {
      d[i][kd[i]++] = x % 10;
      if (!b[x % 10]) good[i] = false;
      mask[i] |= (1 << (x % 10));
      x /= 10;
    }
    if (i == 0 && !b[0]) good[i] = false;
    if (i == 0) {
      d[i][kd[i]++] = 0;
      mask[i] |= (1 << 0);
    }
    if (good[i]) g[kg++] = i;
  }
  int ka = 0;
  for (w = 0; w < 256; w++)
    if (good[w])
      for (i = 0; i < 256; i++)
        if (good[i])
          for (j = 0; j < 256; j++)
            if (good[j]) {
              if ((mask[w] | mask[i] | mask[j]) != need) continue;
              for (k = 0; k < 256; k++)
                if (good[k]) {
                  int u = 0;
                  for (y = kd[w] - 1; y >= 0; y--) q[u++] = d[w][y];
                  for (y = kd[i] - 1; y >= 0; y--) q[u++] = d[i][y];
                  for (y = kd[j] - 1; y >= 0; y--) q[u++] = d[j][y];
                  for (y = kd[k] - 1; y >= 0; y--) q[u++] = d[k][y];
                  int ok = 1;
                  for (y = 0; y < u - y - 1; y++)
                    if (q[y] != q[u - y - 1]) {
                      ok = 0;
                      break;
                    }
                  if (ok) {
                    aw[ka] = w;
                    ai[ka] = i;
                    aj[ka] = j;
                    ak[ka] = k;
                    ka++;
                  }
                }
            }
  cout << ka << endl;
  for (i = 0; i < ka; i++) {
    cout << aw[i] << "." << ai[i] << "." << aj[i] << "." << ak[i] << endl;
  }
  return 0;
}
