#include <bits/stdc++.h>
using namespace std;
vector<string> res;
vector<long> a;
void rec(const string &s, int pos, int used, string &now) {
  if (pos == s.size() && used == 4) {
    res.push_back(now);
    return;
  }
  if (pos == s.size()) return;
  long size = now.size();
  if (pos) now.push_back('.');
  now.push_back(s[pos]);
  long temp = s[pos] - '0';
  rec(s, pos + 1, used + 1, now);
  if (temp == 0) {
    now.resize(size);
    return;
  }
  for (int i = pos + 1; i < s.size(); i++) {
    temp = temp * 10 + s[i] - '0';
    now.push_back(s[i]);
    if (temp > 255) {
      now.resize(size);
      return;
    }
    rec(s, i + 1, used + 1, now);
  }
  now.resize(size);
}
void check(const string &s) {
  string s2 = s;
  vector<bool> used(10, false);
  for (long i = 0; i < s.size(); i++) used[s[i] - '0'] = true;
  for (long i = 0; i < a.size(); i++)
    if (!used[a[i]]) return;
  reverse(s2.begin(), s2.end());
  for (long i = 0; i < s.size(); i++) s2.push_back(s[i]);
  string temp;
  rec(s2, 0, 0, temp);
  s2.erase(s2.begin() + (s2.size() / 2));
  rec(s2, 0, 0, temp);
  s2 = s;
  for (long i = 0; i < s.size(); i++) s2.push_back(s[s.size() - i - 1]);
  rec(s2, 0, 0, temp);
  if (s2.size()) s2.erase(s2.begin() + (s2.size() / 2));
  rec(s2, 0, 0, temp);
}
void rec2(string &s) {
  check(s);
  if (s.size() == 6) return;
  for (long i = 0; i < a.size(); i++) {
    s.push_back(a[i] + '0');
    rec2(s);
    s.erase(s.end() - 1);
  }
}
int main() {
  int n;
  cin >> n;
  if (n > 6) {
    cout << 0;
    return 0;
  }
  a.resize(n);
  for (long i = 0; i < n; i++) cin >> a[i];
  string temp;
  rec2(temp);
  sort(res.begin(), res.end());
  long m = unique(res.begin(), res.end()) - res.begin();
  cout << m << "\n";
  for (long i = 0; i < m; i++) cout << res[i] << "\n";
}
