#include <bits/stdc++.h>
using namespace std;
int n, l, all;
int x[10];
int u[20];
vector<int> xx;
void out(int x) { xx.push_back(x); }
void gao(int j, int ip, int k = 0) {
  if (k == 4) {
    if (j == l) out(ip);
    return;
  }
  if (u[j] == 0) {
    gao(j + 1, ip << 8, k + 1);
  } else {
    for (int t = u[j]; t <= 255; t = t * 10 + u[++j])
      gao(j + 1, ip << 8 | t, k + 1);
  }
}
void dfs(int L, int z) {
  if (L >= 2 && z == all) {
    l = L << 1;
    for (int i = 0; i < L; ++i) u[l - 1 - i] = u[i];
    gao(0, 0);
  }
  if (L >= 3 && z == all) {
    l = (L << 1) - 1;
    for (int i = 0; i + 1 < L; ++i) u[l - 1 - i] = u[i];
    gao(0, 0);
  }
  if (L <= 5)
    for (int i = 0; i < n; ++i) {
      u[L] = x[i];
      dfs(L + 1, z | 1 << i);
    }
}
int main() {
  scanf("%d", &n);
  all = (1 << n) - 1;
  for (int i = 0; i < n; ++i) scanf("%d", x + i);
  dfs(0, 0);
  printf("%u\n", xx.size());
  for (unsigned i = 0, t; i < xx.size(); ++i) {
    t = xx[i];
    printf("%u.%u.%u.%u\n", t >> 24, t >> 16 & 255, t >> 8 & 255, t & 255);
  }
}
