#include <bits/stdc++.h>
#pragma comment(linker, "/STACK:33554432")
using namespace std;
int n;
vector<int> res;
char buf[1 << 4];
int mask;
int len;
void check(int pos, int n, int cur) {
  if (n == 4) {
    if (pos == len) res.push_back(cur);
    return;
  }
  if (pos >= len) return;
  if (buf[pos] == '0')
    check(pos + 1, n + 1, cur << 8);
  else {
    int t = 0;
    for (int i = 0; pos + i < len; ++i) {
      t = t * 10 + (buf[pos + i] - '0');
      if (t > 255) break;
      check(pos + i + 1, n + 1, (cur << 8) | t);
    }
  }
}
void go(int L, int R, int curmask) {
  if (L > R) {
    if (curmask == mask) check(0, 0, 0);
    return;
  }
  for (int i = 0; i < 10; ++i)
    if (mask & (1 << i)) {
      buf[L] = i + '0';
      buf[R] = i + '0';
      go(L + 1, R - 1, curmask | (1 << i));
    }
}
int main() {
  scanf("%d", &n);
  for (int i = 0; i < n; ++i) {
    int x;
    scanf("%d", &x);
    mask |= 1 << x;
  }
  for (len = 4; len <= 12; ++len) go(0, len - 1, 0);
  printf("%d\n", res.size());
  for (int i = 0; i < res.size(); ++i) {
    int a = (res[i] >> 24) & 255;
    int b = (res[i] >> 16) & 255;
    int c = (res[i] >> 8) & 255;
    int d = (res[i] >> 0) & 255;
    printf("%d.%d.%d.%d\n", a, b, c, d);
  }
  return 0;
}
