#include <bits/stdc++.h>
using namespace std;
vector<string> ans;
bool check(string s, int L, int R) {
  if (s[L] == '0') {
    if (R == L + 1) {
      return true;
    }
    return false;
  }
  int n = 0;
  for (int i = L; i < R; i++) {
    n *= 10;
    n += s[i] - '0';
  }
  return (n >= 0 && n < 256);
}
void func(string s) {
  int N = s.length();
  for (int i = 1; i <= 3; i++) {
    for (int j = i + 1; j <= i + 3; j++) {
      for (int k = j + 1; k <= j + 3; k++) {
        if (N - k >= 1 && N - k <= 3) {
          if (check(s, 0, i) && check(s, i, j) && check(s, j, k) &&
              check(s, k, N)) {
            string final;
            final = s.substr(0, i) + "." + s.substr(i, j - i) + "." +
                    s.substr(j, k - j) + "." + s.substr(k, N - k);
            ans.push_back(final);
          }
        }
      }
    }
  }
}
void dfs(int L, string s, int mask, int pos, int used) {
  if (pos == L) {
    if (used == mask) {
      func(s);
      return;
    }
  }
  int pos2 = L - 1 - pos;
  if (pos2 < pos) {
    if (mask != used) {
      return;
    }
    char c = s[pos2];
    dfs(L, s + c, mask, pos + 1, used);
  } else {
    char c;
    for (int i = 0; i < 10; i++) {
      if (mask & (1 << i)) {
        c = i + '0';
        dfs(L, s + c, mask, pos + 1, (used | (1 << i)));
      }
    }
  }
}
int main() {
  int n;
  int a[11];
  cin >> n;
  int mask = 0;
  for (int i = 1; i <= n; i++) {
    cin >> a[i];
    mask |= (1 << a[i]);
  }
  if (n <= 6) {
    for (int i = 4; i <= 12; i++) {
      dfs(i, "", mask, 0, 0);
    }
  }
  cout << ans.size() << endl;
  for (int i = 0; i < ans.size(); i++) {
    cout << ans[i].c_str() << endl;
  }
  return 0;
}
