#include <bits/stdc++.h>
using namespace std;
long long v[1000], f[1000], n, vis[10000], anss, i, o;
struct node {
  long long a[10];
} ans[100000];
long long calc(long long l, long long r) {
  long long tmp = 0, p = 1;
  for (long long i = r; i >= l; i--) {
    tmp += v[i] * p;
    p = p * 10;
  }
  return tmp;
}
bool pan(long long l, long long r) {
  if (l == r && v[l] == 0) return true;
  if (v[l] == 0) return false;
  long long tmp = 0, p = 1;
  for (long long i = r; i >= l; i--) {
    tmp += v[i] * p;
    p = p * 10;
  }
  if (tmp < 256) return true;
  return false;
}
void check(long long y) {
  for (long long i = 1; i <= y / 2; i++) v[y - i + 1] = v[i];
  for (long long i = 0; i <= 10; i++) vis[i] = 0;
  if (v[1] == 0 && v[2] == 1 && v[3] == 8 && v[4] == 9) v[1] = v[1];
  long long cnt = 0;
  for (long long i = 1; i <= y / 2 + 1; i++)
    if (vis[v[i]] == 0) vis[v[i]] = 1, cnt++;
  if (cnt != n) return;
  for (long long a = 1; a <= y - 3; a++) {
    if (!pan(1, a)) continue;
    for (long long b = a + 1; b <= y - 2; b++) {
      if (!pan(a + 1, b)) continue;
      for (long long c = b + 1; c <= y - 1; c++) {
        if (!pan(b + 1, c)) continue;
        if (!pan(c + 1, y)) continue;
        anss++;
        ans[anss].a[1] = calc(1, a);
        ans[anss].a[2] = calc(a + 1, b);
        ans[anss].a[3] = calc(b + 1, c);
        ans[anss].a[4] = calc(c + 1, y);
        if (ans[anss].a[1] == 0 && ans[anss].a[2] == 18 && ans[anss].a[3] == 98)
          n = n;
      }
    }
  }
}
void dfs(long long x, long long y) {
  if (x == y / 2 + 2) {
    check(y);
    return;
  }
  for (long long k = 0; k <= 10; k++) {
    if (f[k]) v[x] = k, dfs(x + 1, y);
  }
}
bool cmp(node x, node y) {
  if (x.a[1] == y.a[1]) {
    if (x.a[2] == y.a[2]) {
      if (x.a[3] == y.a[3]) {
        return x.a[4] < y.a[4];
      }
      return x.a[3] < y.a[3];
    }
    return x.a[2] < y.a[2];
  }
  return x.a[1] < y.a[1];
}
int main() {
  scanf("%I64d", &n);
  for (i = 1; i <= n; i++) {
    scanf("%I64d", &o), f[o] = 1;
  }
  for (i = 4; i <= 12; i++) {
    dfs(1, i);
  }
  sort(ans + 1, ans + anss + 1, cmp);
  int t = 0;
  ans[0].a[1] = -1;
  for (i = 1; i <= anss; i++)
    if (ans[i].a[1] != ans[i - 1].a[1] || ans[i].a[2] != ans[i - 1].a[2] ||
        ans[i].a[3] != ans[i - 1].a[3] || ans[i].a[4] != ans[i - 1].a[4])
      t++;
  cout << t << endl;
  for (i = 1; i <= anss; i++)
    if (ans[i].a[1] != ans[i - 1].a[1] || ans[i].a[2] != ans[i - 1].a[2] ||
        ans[i].a[3] != ans[i - 1].a[3] || ans[i].a[4] != ans[i - 1].a[4])
      printf("%I64d.%I64d.%I64d.%I64d\n", ans[i].a[1], ans[i].a[2], ans[i].a[3],
             ans[i].a[4]);
}
