#include <bits/stdc++.h>
using namespace std;
vector<vector<int> > ans;
vector<int> ip, a;
int d[20], n;
void dfs(int x, int y) {
  if (x == 4) {
    if (!~d[y]) ans.push_back(ip);
    return;
  } else if (d[y] == 0) {
    ip[x] = 0;
    dfs(x + 1, y + 1);
    return;
  } else {
    ip[x] = 0;
    for (int i = y; ~d[i]; i++) {
      ip[x] = ip[x] * 10 + d[i];
      if (ip[x] < 256) dfs(x + 1, i + 1);
    }
  }
}
void rec(int l, int r, int mask) {
  if (l <= r) {
    for (int i = 0; i < (int)a.size(); ++i) {
      d[l] = d[r] = a[i];
      rec(l + 1, r - 1, mask & ~(1 << i));
    }
  } else if (!mask)
    dfs(0, 0);
}
int main() {
  ip.resize(4);
  scanf("%d", &n);
  a.resize(n);
  for (int i = 0; i < n; i++) scanf("%d", &a[i]);
  for (int i = 4; i <= 12; i++) {
    d[i] = -1;
    rec(0, i - 1, (1 << n) - 1);
  }
  printf("%d\n", ans.size());
  for (int i = 0; i < ans.size(); i++)
    printf("%d.%d.%d.%d\n", ans[i][0], ans[i][1], ans[i][2], ans[i][3]);
  return 0;
}
