#include <bits/stdc++.h>
using namespace std;
char xau[20];
bool has[15], good[260];
string str[260];
map<string, bool> res;
int a[15], mask[260];
int n, statemax;
inline bool check(int x) {
  int val = x;
  do {
    if (!has[x % 10]) return false;
    mask[val] |= 1 << (x % 10);
    x /= 10;
  } while (x);
  return true;
}
inline string so_xau(int x) {
  sprintf(xau, "%d", x);
  return xau;
}
bool numb(char s[], int l, int r, int &val) {
  val = 0;
  if (l == r) {
    val = s[l] - '0';
    return good[val];
  }
  if (s[l] == '0') return false;
  int i;
  for ((i) = (l); (i) <= (r); (i)++) val = val * 10 + s[i] - '0';
  return (val < 256) && good[val];
}
void palin(char s[], int len) {
  int i = 0, j = len - 1;
  while (i < j) {
    if (s[i] != s[j]) return;
    i++, j--;
  }
  int k, cur, x, y, z, t;
  string temp;
  for ((i) = (0); (i) <= (((2) < (len - 4) ? (2) : (len - 4))); (i)++)
    for ((j) = (i + 1); (j) <= (((i + 3) < (len - 3) ? (i + 3) : (len - 3)));
         (j)++)
      for ((k) = (j + 1); (k) <= (((j + 3) < (len - 2) ? (j + 3) : (len - 2)));
           (k)++)
        if (len - k - 1 > 0 && len - k - 1 <= 3) {
          if (numb(s, 0, i, x) && numb(s, i + 1, j, y) &&
              numb(s, j + 1, k, z) && numb(s, k + 1, len - 1, t)) {
            temp = str[x] + '.' + str[y] + '.' + str[z] + '.' + str[t];
            res[temp] = true;
          }
        }
}
void palin(char s1[], char s2[], int len) {
  char s[20];
  int i, j;
  for ((i) = 0; (i) < (len); (i)++) s[i] = s1[i];
  for ((j) = (len - 1); (j) >= 0; (j)--) s[i++] = s2[j];
  len += len;
  i = 0, j = len - 1;
  while (i < j) {
    if (s[i] != s[j]) return;
    i++, j--;
  }
  int k, cur, x, y, z, t;
  string temp;
  for ((i) = (0); (i) <= (((2) < (len - 4) ? (2) : (len - 4))); (i)++)
    for ((j) = (i + 1); (j) <= (((i + 3) < (len - 3) ? (i + 3) : (len - 3)));
         (j)++)
      for ((k) = (j + 1); (k) <= (((j + 3) < (len - 2) ? (j + 3) : (len - 2)));
           (k)++)
        if (len - k - 1 > 0 && len - k - 1 <= 3) {
          if (numb(s, 0, i, x) && numb(s, i + 1, j, y) &&
              numb(s, j + 1, k, z) && numb(s, k + 1, len - 1, t)) {
            temp = str[x] + '.' + str[y] + '.' + str[z] + '.' + str[t];
            res[temp] = true;
          }
        }
}
void palin(char s1[], char s2[], int len, int len2) {
  char s[20];
  int i, j;
  for ((i) = 0; (i) < (len); (i)++) s[i] = s1[i];
  for ((j) = (len2 - 1); (j) >= 0; (j)--) s[i++] = s2[j];
  len += len2;
  i = 0, j = len - 1;
  while (i < j) {
    if (s[i] != s[j]) return;
    i++, j--;
  }
  int k, cur, x, y, z, t;
  string temp;
  for ((i) = (0); (i) <= (((2) < (len - 4) ? (2) : (len - 4))); (i)++)
    for ((j) = (i + 1); (j) <= (((i + 3) < (len - 3) ? (i + 3) : (len - 3)));
         (j)++)
      for ((k) = (j + 1); (k) <= (((j + 3) < (len - 2) ? (j + 3) : (len - 2)));
           (k)++)
        if (len - k - 1 > 0 && len - k - 1 <= 3) {
          if (numb(s, 0, i, x) && numb(s, i + 1, j, y) &&
              numb(s, j + 1, k, z) && numb(s, k + 1, len - 1, t)) {
            temp = str[x] + '.' + str[y] + '.' + str[z] + '.' + str[t];
            res[temp] = true;
          }
        }
}
void ktra(int len) {
  if (len >= 4) palin(xau, len);
  palin(xau, xau, len);
  palin(xau, xau, len, len - 1);
}
void dfs(int len, int state) {
  if (len >= 2 && state == statemax) {
    ktra(len);
  }
  if (len == 6) return;
  int i;
  for ((i) = 0; (i) < (n); (i)++) {
    xau[len] = a[i] + '0';
    dfs(len + 1, state | (1 << a[i]));
  }
}
void input() {
  int i;
  scanf("%d", &n);
  statemax = 0;
  for ((i) = 0; (i) < (n); (i)++)
    scanf("%d", &a[i]), has[a[i]] = true, statemax |= (1 << a[i]);
  for ((i) = 0; (i) < (256); (i)++) good[i] = check(i), str[i] = so_xau(i);
  dfs(0, 0);
  printf("%d\n", res.size());
  for (typeof(res.begin()) ite = res.begin(); ite != res.end(); ite++)
    printf("%s\n", ite->first.c_str());
}
int main() {
  input();
  return 0;
}
