#include <bits/stdc++.h>
using namespace std;
const int INF = 1E9 + 7;
template <class C>
void mini(C& a4, C b4) {
  a4 = min(a4, b4);
}
template <class C>
void maxi(C& a4, C b4) {
  a4 = max(a4, b4);
}
void print(unsigned u);
set<unsigned> S;
void generate(long long x, int l, int t, unsigned cur, long long y) {
  if (t == 16 && l == 0) {
    S.insert(cur);
  }
  if (t == 16) return;
  generate(x / 10, l - 1, t + 4, (cur << 8) + (x % 10), y);
  if (x % 100 >= 10) generate(x / 100, l - 2, t + 4, (cur << 8) + x % 100, y);
  if (x % 1000 < 256 && x % 1000 >= 100) {
    generate(x / 1000, l - 3, t + 4, (cur << 8) + (x % 1000), y);
  }
}
long long pal(int x, int n) {
  int y = x;
  long long res = 0;
  for (int i = 0; i < (n); ++i) {
    res *= 10;
    if (i < n / 2) {
      res += y % 10;
      y /= 10;
    }
  }
  res += x;
  return res;
}
void print(unsigned u) {
  long long msk = 255;
  for (int i = 0; i < (4); ++i) {
    cout << ((u & (msk << (8 * i))) >> (8 * i));
    if (i != 3) cout << ".";
  }
  cout << endl;
}
bool a[10];
void palindromes(int len) {
  int d = (len + 1) / 2;
  int pw = 1;
  for (int i = 0; i < (d); ++i) pw *= 10;
  for (int x = 0; x < (pw); ++x) {
    if (!a[x % 10]) continue;
    int y = x;
    bool ok = true;
    int b[10];
    for (int i = 0; i < (10); ++i) b[i] = 0;
    for (int i = 0; i < (d); ++i) {
      b[y % 10] = true;
      y /= 10;
    }
    for (int i = 0; i < (10); ++i) {
      if ((b[i] > 0) != a[i]) ok = false;
    }
    if (!ok) continue;
    generate(pal(x, len), len, 0, 0, pal(x, len));
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  int n;
  cin >> n;
  for (int i = 0; i < (n); ++i) {
    int x;
    cin >> x;
    a[x] = true;
  }
  if (n <= 6) {
    for (int i = (4); i <= (12); ++i) {
      palindromes(i);
    }
  }
  cout << ((int)(S).size()) << endl;
  for (__typeof((S).begin()) it = ((S).begin()); it != (S).end(); ++it) {
    print(*it);
  }
  return 0;
}
