#include <bits/stdc++.h>
using namespace std;
const int MOD = 1000000007;
int a[10];
int cnt[10];
string s;
int n;
bool isValid(string ip) {
  if (ip.size() == 1) {
    return true;
  }
  if (ip.size() == 2) {
    return ip[0] != '0';
  }
  if (ip[0] == '1') {
    return true;
  }
  if (ip[0] == '2') {
    if (ip[1] < '5') {
      return true;
    }
    if (ip[1] == '5') {
      return ip[2] < '6';
    }
  }
  return false;
}
vector<string> sol;
vector<char> pool;
void dfs(int curIndex) {
  if (curIndex > (s.size() - 1) / 2) {
    bool hasAllNumbers = true;
    for (int i = 0; i < n; ++i) {
      if (!cnt[a[i]]) {
        hasAllNumbers = false;
      }
    }
    if (hasAllNumbers) {
      for (int dotPos1 = 1; dotPos1 <= 3; ++dotPos1) {
        for (int dotPos2 = dotPos1 + 1; dotPos2 <= dotPos1 + 3; ++dotPos2) {
          for (int dotPos3 = dotPos2 + 1; dotPos3 <= dotPos2 + 3; ++dotPos3) {
            if (s.size() - dotPos3 <= 3) {
              string ip1 = s.substr(0, dotPos1);
              string ip2 = s.substr(dotPos1, dotPos2 - dotPos1);
              string ip3 = s.substr(dotPos2, dotPos3 - dotPos2);
              string ip4 = s.substr(dotPos3);
              if (isValid(ip1) && isValid(ip2) && isValid(ip3) &&
                  isValid(ip4)) {
                sol.push_back(ip1 + "." + ip2 + "." + ip3 + "." + ip4);
              }
            }
          }
        }
      }
    }
    return;
  }
  for (int i = 0; i < n; ++i) {
    s[curIndex] = s[s.size() - curIndex - 1] = pool[i];
    ++cnt[s[curIndex] - '0'];
    dfs(curIndex + 1);
    --cnt[s[curIndex] - '0'];
  }
  s[curIndex] = s[s.size() - curIndex - 1] = pool[0];
}
int main() {
  cin >> n;
  for (int i = 0; i < n; ++i) {
    scanf("%d", &a[i]);
    pool.push_back('0' + a[i]);
  }
  for (int len = 4; len <= 12; ++len) {
    memset(cnt, 0, sizeof(cnt));
    s = string(len, pool[0]);
    dfs(0);
  }
  cout << sol.size() << endl;
  for (string s : sol) {
    cout << s << '\n';
  }
  return 0;
}
