#include <bits/stdc++.h>
using namespace std;
int a[10];
int n;
int i1, i2, i3, i4;
vector<int> cur;
int len;
int over;
string s;
vector<string> ans;
void go(int p, int mask) {
  if (p == over) {
    if (mask) return;
    int left = len - over;
    for (int i = (0); i < (left); ++i) cur[len - i - 1] = cur[i];
    int now = 0;
    bool f = true, lz = false;
    for (int i = (0); i < (len); ++i) {
      if ((now == 0) && (cur[i] == 0)) {
        lz = true;
      }
      now = now * 10 + cur[i];
      if ((i == i1 - 1) || (i == i1 + i2 - 1) || (i == i1 + i2 + i3 - 1) ||
          (i == i1 + i2 + i3 + i4 - 1)) {
        if (now > 255) f = false;
        if ((i == i1 - 1) && (i1 > 1) && (lz)) {
          f = false;
          break;
        }
        if ((i == i1 + i2 - 1) && (i2 > 1) && (lz)) {
          f = false;
          break;
        }
        if ((i == i1 + i2 + i3 - 1) && (i3 > 1) && (lz)) {
          f = false;
          break;
        }
        if ((i == i1 + i2 + i3 + i4 - 1) && (i4 > 1) && (lz)) {
          f = false;
          break;
        }
        lz = false;
        now = 0;
      }
    }
    if (f) {
      s = "";
      for (int i = (0); i < (len); ++i) {
        s += (cur[i] + '0');
        if ((i == i1 - 1) || (i == i1 + i2 - 1) || (i == i1 + i2 + i3 - 1))
          s += '.';
      }
      ans.push_back(s);
    }
    return;
  }
  for (int i = (0); i < (n); ++i) {
    cur[p] = a[i];
    int nmask = mask;
    if ((nmask >> i) & 1) nmask ^= (1 << i);
    go(p + 1, nmask);
  }
}
int main() {
  scanf("%d", &n);
  for (int i = (0); i < (n); ++i) scanf("%d", &a[i]);
  for (i1 = 1; i1 <= 3; ++i1)
    for (i2 = 1; i2 <= 3; ++i2)
      for (i3 = 1; i3 <= 3; ++i3)
        for (i4 = 1; i4 <= 3; ++i4) {
          len = i1 + i2 + i3 + i4;
          over = len / 2 + (len & 1);
          cur.clear();
          cur.resize(len);
          go(0, (1 << n) - 1);
        }
  printf("%d\n", ans.size());
  for (int i = (0); i < (ans.size()); ++i) printf("%s\n", ans[i].c_str());
  return 0;
}
