#include <bits/stdc++.h>
using namespace std;
unsigned int m = 0;
bool check(string& s) {
  unsigned int mx = 0;
  for (int h = 0; h < s.size(); ++h) mx |= 1 << (s[h] - '0');
  return mx == m;
}
int main() {
  int n;
  cin >> n;
  for (int i = 0; i < n; ++i) {
    int a;
    cin >> a;
    m |= (1 << a);
  }
  if (n > 6) {
    cout << 0;
    return 0;
  }
  vector<string> g;
  for (int i = 0; i < 256; ++i) {
    stringstream s;
    s << i;
    string str = s.str();
    bool f = true;
    for (int i = 0; i < str.size(); ++i) {
      unsigned int e = 0;
      e |= 1 << str[i] - '0';
      if ((m & e) == 0) f = false;
    }
    if (f) g.push_back(str);
  }
  vector<string> q;
  for (int i = 0; i < g.size(); ++i) {
    string ai = g[i];
    for (int j = 0; j < g.size(); ++j) {
      string aj = ai + g[j];
      for (int k = 0; k < g.size(); ++k) {
        string ak = aj + g[k];
        if (!check(ak)) continue;
        vector<string> s;
        string sss = "";
        sss += ak[0];
        s.push_back(sss);
        if (ak[1] != '0') {
          sss = "";
          sss += ak[1];
          sss += ak[0];
          s.push_back(sss);
        }
        if (ak[2] != '0' && ak[2] < '3') {
          if (!(ak[2] == '2' && (ak[1] > '5' || ak[1] == '5' && ak[0] > '5'))) {
            sss = "";
            sss += ak[2];
            sss += ak[1];
            sss += ak[0];
            s.push_back(sss);
          }
        }
        for (int w = 0; w < s.size(); ++w) {
          string sa = ak + s[w];
          bool f = true;
          int sz = sa.size();
          for (int h = 0; h < sz / 2; ++h) {
            if (sa[h] != sa[sz - h - 1]) {
              f = false;
              break;
            }
          }
          if (f) {
            string st = g[i];
            st += '.';
            st += g[j];
            st += '.';
            st += g[k];
            st += '.';
            st += s[w];
            q.push_back(st);
          }
        }
      }
    }
  }
  cout << q.size() << endl;
  for (int i = 0; i < q.size(); ++i) cout << q[i] << endl;
  return 0;
}
