#include <bits/stdc++.h>
using namespace std;
int b[20], good[300], kd[300], mask[300], q[300], d[300][300];
int aw[1100000], ax[1100000], ay[1100000], az[1100000];
int need;
int main() {
  int n, m, i, j, k, w, x;
  cin >> n;
  for (i = 1; i <= n; i++) {
    cin >> x;
    need |= (1 << x);
    b[x] = 1;
  }
  if (n > 6) {
    puts("0");
    return 0;
  }
  for (i = 0; i < 256; i++) {
    good[i] = 1;
    x = i;
    mask[i] = 0;
    kd[i] = 0;
    while (x > 0) {
      d[i][kd[i]++] = x % 10;
      if (!b[x % 10]) good[i] = 0;
      mask[i] |= (1 << (x % 10));
      x /= 10;
    }
    if (i == 0 && !b[0]) good[i] = 0;
    if (i == 0) {
      d[i][kd[i]++] = 0;
      mask[i] |= (1 << 0);
    }
  }
  int ans = 0;
  for (i = 0; i < 256; i++)
    if (good[i])
      for (j = 0; j < 256; j++)
        if (good[j])
          for (k = 0; k < 256; k++)
            if (good[k]) {
              if ((mask[i] | mask[j] | mask[k]) == need)
                for (w = 0; w < 256; w++)
                  if (good[w]) {
                    int u = 0;
                    for (m = kd[i] - 1; m >= 0; m--) q[++u] = d[i][m];
                    for (m = kd[j] - 1; m >= 0; m--) q[++u] = d[j][m];
                    for (m = kd[k] - 1; m >= 0; m--) q[++u] = d[k][m];
                    for (m = kd[w] - 1; m >= 0; m--) q[++u] = d[w][m];
                    int ok = 1;
                    int d = u / 2;
                    for (m = 1; m <= d; m++)
                      if (q[m] != q[u - m + 1]) {
                        ok = 0;
                        break;
                      }
                    if (ok) {
                      ans++;
                      aw[ans] = i;
                      ax[ans] = j;
                      ay[ans] = k;
                      az[ans] = w;
                    }
                  }
            }
  cout << ans << endl;
  for (i = 1; i <= ans; i++)
    cout << aw[i] << '.' << ax[i] << '.' << ay[i] << '.' << az[i] << endl;
  return 0;
}
