#include <bits/stdc++.h>
using namespace std;
int mp[15], n, a[15];
struct node {
  int p[4];
};
vector<node> vec;
void dfs(int sz, int pos, int dep, int p[]) {
  if (dep == 3) {
    if (sz > pos && sz <= pos + 3) {
      int k = 1;
      p[dep] = 0;
      for (int i = sz - 1; i >= pos; i--) {
        p[dep] += a[i] * k;
        k *= 10;
      }
      if ((a[pos] || sz == pos + 1) && p[dep] < 256) {
        node in;
        for (int i = 0; i < 4; i++) in.p[i] = p[i];
        vec.push_back(in);
      }
    }
    return;
  }
  for (int i = pos; i < pos + 3 && i < sz; i++) {
    int k = 1;
    p[dep] = 0;
    for (int j = i; j >= pos; j--) {
      p[dep] += a[j] * k;
      k *= 10;
    }
    if ((a[pos] || i == pos) && p[dep] < 256) {
      dfs(sz, i + 1, dep + 1, p);
    }
  }
}
bool cmp(node x, node y) {
  if (x.p[0] != y.p[0]) return x.p[0] < y.p[0];
  if (x.p[1] != y.p[1]) return x.p[1] < y.p[1];
  if (x.p[2] != y.p[2]) return x.p[2] < y.p[2];
  return x.p[3] < y.p[3];
}
void get(int cnt, bool flag) {
  for (int j = 0; j < cnt; j++) a[cnt + j] = a[cnt - j - 1];
  int p[4];
  p[0] = 0;
  if (cnt > 1) dfs(cnt * 2, flag, flag, p);
  for (int j = 0; j < cnt - 1; j++) a[cnt + j] = a[cnt - j - 2];
  if (cnt > 2) dfs(cnt * 2 - 1, flag, flag, p);
}
int main() {
  scanf("%d", &n);
  for (int i = 0; i < n; i++) {
    int x;
    scanf("%d", &x);
    mp[x] = 1;
  }
  if (n == 1 && mp[0]) {
    printf("1\n0.0.0.0\n");
    return 0;
  }
  for (int i = 1; i < 1000000; i++) {
    bool t = true;
    int x = i, cnt = 0;
    int temp[10];
    memset(temp, 0, sizeof(temp));
    while (x) {
      a[cnt++] = x % 10;
      temp[x % 10] = 1;
      if (!mp[x % 10]) t = false;
      x /= 10;
    }
    int xxx = 0;
    for (int j = 0; j < 10 && t; j++)
      if (mp[j]) xxx += temp[j];
    if (t) {
      for (int l = 0, r = cnt - 1; l < r; l++, r--) swap(a[l], a[r]);
      if (xxx == n) {
        get(cnt, false);
      }
      if (mp[0] && cnt < 6 && (xxx == n || (xxx == n - 1 && !temp[0]))) {
        for (int j = cnt; j > 0; j--) a[j] = a[j - 1];
        a[0] = 0;
        get(cnt + 1, true);
        if (cnt < 5) {
          cnt++;
          for (int j = cnt; j > 0; j--) a[j] = a[j - 1];
          a[0] = 0;
          get(cnt + 1, true);
        }
      }
    }
  }
  printf("%d\n", vec.size());
  for (int i = 0; i < vec.size(); i++) {
    for (int j = 0; j < 4; j++)
      printf("%d%c", vec[i].p[j], (j == 3) ? '\n' : '.');
  }
  return 0;
}
