#include <bits/stdc++.h>
using namespace std;
int a[20], b[20];
vector<long long> s;
map<long long, int> used;
inline void gen(long long x, int l, int t, long long cur) {
  if (t == 4 && l == 0) {
    s.push_back(cur);
    used[cur] = 0;
  }
  if (t == 4 || l == 0) return;
  gen(x / 10, l - 1, t + 1, (cur << 8) + (x % 10));
  if (x % 100 >= 10) gen(x / 100, l - 2, t + 1, (cur << 8) + x % 100);
  if (x % 1000 < 256 && x % 1000 >= 100)
    gen(x / 1000, l - 3, t + 1, (cur << 8) + x % 1000);
}
inline long long pal(int x, int n) {
  int y = x;
  long long res = 0;
  for (int i = 1; i <= n; i++) {
    res *= 10;
    if (i <= n / 2) {
      res += y % 10;
      y /= 10;
    }
  }
  res += x;
  return res;
}
inline void go(int len) {
  int d = (len + 1) / 2;
  int pw = 1;
  for (int i = 1; i <= d; i++) pw *= 10;
  for (int x = 0; x < pw; x++) {
    if (!a[x % 10]) continue;
    int y = x;
    bool ok = 1;
    for (int i = 0; i < 10; i++) b[i] = 0;
    for (int i = 0; i < d; i++) {
      b[y % 10] = 1;
      y /= 10;
    }
    for (int i = 0; i < 10; i++)
      if (b[i] != a[i]) {
        ok = 0;
        break;
      }
    if (ok) gen(pal(x, len), len, 0, 0);
  }
}
inline void print(long long u) {
  long long mk = 255;
  if (used[u]) return;
  for (int i = 0; i < 4; i++) {
    cout << ((u & (mk << (8 * i))) >> (8 * i));
    if (i < 3) cout << '.';
  }
  cout << endl;
  used[u] = 1;
}
int main() {
  int n, m, i, j, k, x;
  cin >> n;
  for (i = 1; i <= n; i++) {
    cin >> x;
    a[x] = 1;
  }
  if (n <= 6) {
    for (i = 4; i <= 12; i++)
      if (i >= 2 * n - 1) go(i);
  }
  cout << s.size() << endl;
  for (i = 0; i < s.size(); i++) print(s[i]);
  return 0;
}
