#include <bits/stdc++.h>
using namespace std;
template <class F, class T>
T convert(F a, int p = -1) {
  stringstream ss;
  if (p >= 0) ss << fixed << setprecision(p);
  ss << a;
  T r;
  ss >> r;
  return r;
}
template <class T>
T gcd(T a, T b) {
  T r;
  while (b != 0) {
    r = a % b;
    a = b;
    b = r;
  }
  return a;
}
template <class T>
T lcm(T a, T b) {
  return a / gcd(a, b) * b;
}
template <class T>
T sqr(T x) {
  return x * x;
}
template <class T>
T cube(T x) {
  return x * x * x;
}
template <class T>
int getbit(T s, int i) {
  return (s >> i) & 1;
}
template <class T>
T onbit(T s, int i) {
  return s | (T(1) << i);
}
template <class T>
T offbit(T s, int i) {
  return s & (~(T(1) << i));
}
template <class T>
int cntbit(T s) {
  return s == 0 ? 0 : cntbit(s >> 1) + (s & 1);
}
const int bfsz = 1 << 16;
char bf[bfsz + 5];
int rsz = 0;
int ptr = 0;
char gc() {
  if (rsz <= 0) {
    ptr = 0;
    rsz = (int)fread(bf, 1, bfsz, stdin);
    if (rsz <= 0) return EOF;
  }
  --rsz;
  return bf[ptr++];
}
void ga(char &c) {
  c = EOF;
  while (!isalpha(c)) c = gc();
}
int gs(char s[]) {
  int l = 0;
  char c = gc();
  while (isspace(c)) c = gc();
  while (c != EOF && !isspace(c)) {
    s[l++] = c;
    c = gc();
  }
  s[l] = '\0';
  return l;
}
template <class T>
bool gi(T &v) {
  v = 0;
  char c = gc();
  while (c != EOF && c != '-' && !isdigit(c)) c = gc();
  if (c == EOF) return false;
  bool neg = c == '-';
  if (neg) c = gc();
  while (isdigit(c)) {
    v = v * 10 + c - '0';
    c = gc();
  }
  if (neg) v = -v;
  return true;
}
vector<vector<int> > V;
vector<int> T[5];
int f[555];
string str[555];
int doiso(string s) {
  if (s[0] == '0' && s.length() > 1) return 256;
  int res = 0;
  for (int i = 0; i < ((int)s.length()); ++i) {
    res = res * 10 + s[i] - '0';
  }
  return res;
}
string reverse(string x) {
  string res = "";
  for (int i = x.length() - 1; i >= 0; i--) res.push_back(x[i]);
  return res;
}
string doixau(int u) {
  if (u == 0) return "0";
  string res = "";
  while (u > 0) {
    res.push_back(u % 10 + '0');
    u /= 10;
  }
  return reverse(res);
}
string doi1(int a, int b, int len) {
  string res = "";
  res += str[a];
  res += str[b];
  int n = res.length();
  for (int i = (len - 1) >> 1; i >= 0; i--) {
    int j = len - 1 - i;
    if (j < n) {
      if (res[j] != res[i]) return "-1";
    } else
      res.push_back(res[i]);
  }
  return res;
}
string doi2(int a, int b, int len) {
  string res = "", RR = "";
  RR += str[a];
  RR += str[b];
  int n = RR.length();
  res.resize(len);
  for (int i = (len - 1) >> 1; i >= 0; i--) {
    int j = len - 1 - i;
    if (i >= len - n) {
      if (RR[j - len + n] != RR[i - len + n]) return "-1";
      res[i] = RR[j - len + n];
      res[j] = RR[j - len + n];
    } else {
      res[i] = RR[j - len + n];
      res[j] = RR[j - len + n];
    }
  }
  return res;
}
void gen1(int l1, int l2, int r1, int r2) {
  for (int i = 0; i < (((int)(T[l1]).size())); ++i)
    for (int j = 0; j < (((int)(T[l2]).size())); ++j) {
      int a = T[l1][i], b = T[l2][j], A, B;
      string s = doi1(a, b, l1 + l2 + r1 + r2);
      if (s == "-1") continue;
      A = doiso(s.substr(l1 + l2, r1));
      B = doiso(s.substr(l1 + l2 + r1, r2));
      if (f[A] == r1 && f[B] == r2) {
        vector<int> temp;
        temp.push_back(a);
        temp.push_back(b);
        temp.push_back(A);
        temp.push_back(B);
        V.push_back(temp);
      }
    }
}
void gen2(int l1, int l2, int r1, int r2) {
  for (int i = 0; i < (((int)(T[r1]).size())); ++i)
    for (int j = 0; j < (((int)(T[r2]).size())); ++j) {
      int A = T[r1][i], B = T[r2][j], a, b;
      string s = doi2(A, B, l1 + l2 + r1 + r2);
      if (s == "-1") continue;
      a = doiso(s.substr(0, l1));
      b = doiso(s.substr(l1, l2));
      if (f[a] == l1 && f[b] == l2) {
        vector<int> temp;
        temp.push_back(a);
        temp.push_back(b);
        temp.push_back(A);
        temp.push_back(B);
        V.push_back(temp);
      }
    }
}
void init() {
  f[256] = 0;
  for (int i = (0); i <= (9); ++i) {
    T[1].push_back(i);
    f[i] = 1;
  }
  for (int i = (10); i <= (99); ++i) {
    T[2].push_back(i);
    f[i] = 2;
  }
  for (int i = (100); i <= (255); ++i) {
    T[3].push_back(i);
    f[i] = 3;
  }
  for (int i = (0); i <= (255); ++i) str[i] = doixau(i);
  for (int i = (1); i <= (3); ++i)
    for (int j = (1); j <= (3); ++j)
      for (int u = (1); u <= (3); ++u)
        for (int v = (1); v <= (3); ++v) {
          if (i + j >= u + v)
            gen1(i, j, u, v);
          else
            gen2(i, j, u, v);
        }
}
int main() {
  init();
  int n, x;
  int f[15];
  memset(f, 0, sizeof(f));
  cin >> n;
  for (int i = 0; i < (n); ++i) {
    cin >> x;
    f[x] = 1;
  }
  vector<vector<int> > RR;
  for (int i = 0; i < (((int)(V).size())); ++i) {
    int g[15];
    memset(g, 0, sizeof(g));
    for (int j = 0; j < (((int)(V[i]).size())); ++j) {
      int m = V[i][j];
      if (m == 0) g[0] = 1;
      while (m > 0) {
        g[m % 10] = 1;
        m /= 10;
      }
    }
    bool check = true;
    for (int j = 0; j < (10); ++j)
      if (f[j] != g[j]) {
        check = false;
        break;
      }
    if (check) RR.push_back(V[i]);
  }
  cout << ((int)(RR).size()) << endl;
  for (int i = 0; i < (((int)(RR).size())); ++i) {
    for (int j = 0; j < (4); ++j) {
      printf("%d%c", RR[i][j], j == 3 ? '\n' : '.');
    }
  }
  return 0;
}
