#include <bits/stdc++.h>
using namespace std;
int n, m, i, j, need[15], used[15];
vector<string> ans;
bool check(string st) {
  if (st.length() == 1) return 1;
  if (st[0] == '0') return 0;
  int x;
  sscanf(st.c_str(), "%d", &x);
  if (x < 0 || x > 255) return 0;
  return 1;
}
void dfs(int dep, string now, int len) {
  int i;
  if (dep * 2 >= len) {
    for (i = 1; i <= n; i++) {
      if (!used[i]) return;
    }
    string st = now.substr(0, len - dep);
    reverse(st.begin(), st.end());
    st = now + st;
    int i, j, k;
    for (i = 1; i <= 3; i++) {
      for (j = 1; j <= 3; j++) {
        for (k = 1; k <= 3; k++) {
          if (len - i - j - k > 3 || len - i - j - k <= 0) continue;
          string st1 = st.substr(0, i), st2 = st.substr(i, j),
                 st3 = st.substr(i + j, k), st4 = st.substr(i + j + k);
          if (check(st1) && check(st2) && check(st3) && check(st4))
            ans.push_back(st1 + "." + st2 + "." + st3 + "." + st4);
        }
      }
    }
    return;
  }
  for (i = 1; i <= n; i++) {
    used[i]++;
    now.push_back(need[i] + '0');
    dfs(dep + 1, now, len);
    used[i]--;
    now.erase(now.end() - 1);
  }
}
int main() {
  cin >> n;
  if (n > 6) {
    cout << 0;
    return 0;
  }
  for (i = 1; i <= n; i++) cin >> need[i];
  for (i = max(4, n); i <= 12; i++) {
    dfs(0, "", i);
  }
  cout << ans.size() << endl;
  sort(ans.begin(), ans.end());
  for (i = 0; i < ans.size(); i++) cout << ans[i] << endl;
  return 0;
}
