#include <bits/stdc++.h>
using namespace std;
const int N = 15;
const int M = 1e6 + 5;
const int W = 305;
int n, need, kans;
int kd[W], d[W][N], mask[W];
int q[N], ans[M][6];
bool b[N], good[W];
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) {
    int x;
    scanf("%d", &x);
    b[x] = true;
    need |= (1 << x);
  }
  if (n > 6) {
    printf("0\n");
    return 0;
  }
  for (int i = 0; i < 256; i++) {
    good[i] = true;
    int x = i;
    while (x) {
      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);
    }
  }
  for (int w = 0; w < 256; w++)
    if (good[w])
      for (int x = 0; x < 256; x++)
        if (good[x])
          for (int y = 0; y < 256; y++)
            if (good[y]) {
              if ((mask[w] | mask[x] | mask[y]) != need) continue;
              for (int z = 0; z < 256; z++)
                if (good[z]) {
                  int kq = 0;
                  for (int i = kd[w]; i; i--) q[++kq] = d[w][i];
                  for (int i = kd[x]; i; i--) q[++kq] = d[x][i];
                  for (int i = kd[y]; i; i--) q[++kq] = d[y][i];
                  for (int i = kd[z]; i; i--) q[++kq] = d[z][i];
                  bool ok = true;
                  for (int i = 1; i < kq - i + 1; i++)
                    if (q[i] != q[kq - i + 1]) {
                      ok = false;
                      break;
                    }
                  if (ok)
                    ans[++kans][1] = w, ans[kans][2] = x, ans[kans][3] = y,
                    ans[kans][4] = z;
                }
            }
  printf("%d\n", kans);
  for (int i = 1; i <= kans; i++)
    printf("%d.%d.%d.%d\n", ans[i][1], ans[i][2], ans[i][3], ans[i][4]);
  return 0;
}
