#include <bits/stdc++.h>
using namespace std;
const int N = 15;
int n, a[N], c[N * 2];
struct node {
  int mat[4];
} now;
vector<node> res;
int num[N], ans = 0;
void ok(int cur, int p, int len) {
  if (cur == 4) {
    if (p == len) res.push_back(now);
    return;
  }
  int d = 0, tp = p;
  while (p < len) {
    if (tp != p && d == 0) break;
    d = d * 10 + c[p];
    if (d >= 256) break;
    now.mat[cur] = d;
    ok(cur + 1, p + 1, len);
    ++p;
  }
}
void dfs(int len, int cur) {
  if (cur == (len + 1) / 2) {
    if (ans == n) ok(0, 0, len);
    return;
  }
  for (int i = 0; i < n; ++i) {
    c[cur] = c[len - cur - 1] = a[i];
    if (!num[i]) ++ans;
    num[i]++;
    dfs(len, cur + 1);
    num[i]--;
    if (!num[i]) --ans;
  }
}
int main() {
  scanf("%d", &n);
  for (int i = 0; i < n; ++i) scanf("%d", &a[i]);
  for (int i = 4; i <= 12; ++i) dfs(i, 0);
  printf("%d\n", res.size());
  for (int i = 0; i < res.size(); ++i) {
    for (int j = 0; j < 4; ++j) {
      if (j) printf(".");
      printf("%d", res[i].mat[j]);
    }
    puts("");
  }
  return 0;
}
