#include <bits/stdc++.h>
using namespace std;
const int N = 15;
int s[N], st[N], num[N], used[N], a[N], n;
vector<string> ans;
char tmp[2 * N];
void divide(int pos, int sec, int len) {
  if (pos + 3 * (4 - sec) < len) return;
  if (pos + (4 - sec) > len) return;
  if (pos == len && sec == 4) {
    sprintf(tmp, "%d.%d.%d.%d\n", num[1], num[2], num[3], num[4]);
    ans.push_back(tmp);
  }
  if (pos + 1 <= len) {
    num[sec + 1] = s[pos + 1];
    divide(pos + 1, sec + 1, len);
  }
  if (s[pos + 1] && pos + 2 <= len) {
    num[sec + 1] = s[pos + 1] * 10 + s[pos + 2];
    divide(pos + 2, sec + 1, len);
  }
  int x;
  if (s[pos + 1] && pos + 3 <= len &&
      ((x = (s[pos + 1] * 100 + s[pos + 2] * 10 + s[pos + 3])) < 256)) {
    num[sec + 1] = x;
    divide(pos + 3, sec + 1, len);
  }
}
void make(int len) {
  int used_all = true;
  for (int i = 1; i <= n; i++)
    if (!used[a[i]]) {
      used_all = false;
      break;
    }
  if (used_all) {
    for (int i = 1; i <= len; i++) s[i] = st[i], s[len * 2 - i + 1] = st[i];
    divide(0, 0, len * 2);
    for (int i = 1; i <= len; i++) s[i] = st[i], s[len * 2 - i] = st[i];
    divide(0, 0, len * 2 - 1);
  }
  if (len >= 6) return;
  for (int i = 1; i <= n; i++) {
    int x = a[i];
    st[len + 1] = x;
    used[x]++;
    make(len + 1);
    used[x]--;
  }
}
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) scanf("%d", &a[i]);
  memset(used, 0, sizeof(used));
  make(0);
  printf("%d\n", (int)ans.size());
  for (int i = 0; i < ans.size(); i++) cout << ans[i];
  return 0;
}
