#include <bits/stdc++.h>
using namespace std;
struct apair {
  int w, x, y, z;
};
int main() {
  bool good[256] = {true}, dcan[10] = {false};
  int mask[256] = {0};
  int digit[256][3];
  int ed[256];
  int n, a[10];
  cin >> n;
  int need = 0;
  vector<apair> ans;
  for (int i = 1; i <= n; i++) {
    cin >> a[i];
    dcan[a[i]] = 1;
    need |= (1 << a[i]);
  }
  if (n > 6) {
    cout << 0 << endl;
    return 0;
  }
  for (int i = 0; i < 256; i++) {
    int x = i;
    good[i] = true;
    ed[i] = 0;
    while (x > 0) {
      int tmp;
      tmp = x % 10;
      if (!dcan[tmp]) {
        good[i] = false;
      }
      mask[i] |= (1 << (tmp));
      digit[i][ed[i]++] = tmp;
      x /= 10;
    }
    if (0 <= i && i <= 9) {
      ed[i] = 1;
    }
    if (i == 0 && !dcan[i]) {
      good[0] = false;
    }
    mask[0] = 1;
  }
  int wa = 0;
  for (int w = 0; w < 256; w++) {
    if (!good[w]) {
      continue;
    }
    for (int x = 0; x < 256; x++) {
      if (!good[x]) {
        continue;
      }
      for (int y = 0; y < 256; y++) {
        if (!good[y]) {
          continue;
        }
        bool use = false;
        if ((mask[w] | mask[x] | mask[y]) == need) {
          use = 1;
        }
        if (!use) {
          continue;
        }
        for (int z = 0; z < 256; z++) {
          if (!good[z]) {
            continue;
          }
          int ad[14];
          int num = 0;
          for (int i = ed[w] - 1; i >= 0; i--) {
            ad[num++] = digit[w][i];
          }
          for (int i = ed[x] - 1; i >= 0; i--) {
            ad[num++] = digit[x][i];
          }
          for (int i = ed[y] - 1; i >= 0; i--) {
            ad[num++] = digit[y][i];
          }
          for (int i = ed[z] - 1; i >= 0; i--) {
            ad[num++] = digit[z][i];
          }
          bool flag = true;
          for (int i = 0; i <= (num - 1) / 2; i++) {
            if (ad[i] != ad[num - i - 1]) {
              flag = false;
            }
          }
          if (flag) {
            apair eme;
            eme.w = w;
            eme.x = x;
            eme.y = y;
            eme.z = z;
            ans.push_back(eme);
            wa++;
          }
        }
      }
    }
  }
  cout << wa << endl;
  for (int i = 0; i < ans.size(); i++) {
    cout << ans[i].w << "." << ans[i].x << "." << ans[i].y << "." << ans[i].z
         << endl;
  }
  return 0;
}
