#include <bits/stdc++.h>
using namespace std;
bool b[444], flag[444];
int mask[444], kd[444], d[444][444], q[444];
int ww[4444444], xx[4444444], yy[4444444], zz[4444444];
int main() {
  int n;
  cin >> n;
  int f;
  for (int i = 0; i < 10; i++) b[i] = 0;
  int need = 0;
  for (int i = 0; i < n; i++) {
    cin >> f;
    need |= (1 << f);
    b[f] = 1;
  }
  if (n >= 7) {
    cout << 0;
    return 0;
  }
  int kg = 0;
  for (int i = 0; i < 256; i++) {
    flag[i] = 1;
    int x = i;
    mask[i] = 0;
    kd[i] = 0;
    while (x > 0) {
      d[i][kd[i]++] = x % 10;
      if (!b[x % 10]) flag[i] = 0;
      mask[i] |= (1 << (x % 10));
      x /= 10;
    }
    if (i == 0 && !b[0]) flag[i] = false;
    if (i == 0) {
      d[i][kd[i]++] = 0;
      mask[i] |= (1 << 0);
    }
  }
  int ka = 0, cnt = 0;
  for (int w = 0; w < 256; w++)
    if (flag[w])
      for (int x = 0; x < 256; x++)
        if (flag[x])
          for (int y = 0; y < 256; y++) {
            if ((mask[w] | mask[x] | mask[y]) != need) continue;
            if (flag[y])
              for (int z = 0; z < 256; z++) {
                if (!flag[z]) continue;
                int u = 0;
                for (int i = kd[w] - 1; i >= 0; i--) q[u++] = d[w][i];
                for (int i = kd[x] - 1; i >= 0; i--) q[u++] = d[x][i];
                for (int i = kd[y] - 1; i >= 0; i--) q[u++] = d[y][i];
                for (int i = kd[z] - 1; i >= 0; i--) q[u++] = d[z][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) {
                  ww[cnt] = w;
                  xx[cnt] = x;
                  yy[cnt] = y;
                  zz[cnt] = z;
                  cnt++;
                }
              }
          }
  cout << cnt << endl;
  for (int i = 0; i < cnt; i++)
    cout << ww[i] << '.' << xx[i] << '.' << yy[i] << '.' << zz[i] << endl;
  return 0;
}
