#include <bits/stdc++.h>
using namespace std;
int a[20];
int ip[5];
int ans[100000][5];
int d[20];
int cnt, n;
inline void pr(int n, int m) {
  if (n == 4) {
    if (d[m] == -1) {
      ans[++cnt][0] = ip[0];
      ans[cnt][1] = ip[1];
      ans[cnt][2] = ip[2];
      ans[cnt][3] = ip[3];
    }
  } else if (d[m] == 0) {
    ip[n] = 0;
    pr(n + 1, m + 1);
  } else {
    ip[n] = 0;
    for (int i = m; d[i] != -1; i++) {
      ip[n] = ip[n] * 10 + d[i];
      if (ip[n] < 256) {
        pr(n + 1, i + 1);
      } else
        break;
    }
  }
}
inline void gen(int l, int r, int mask) {
  int i, j, k;
  if (l <= r) {
    for (i = 0; i < n; i++) {
      d[l] = d[r] = a[i];
      gen(l + 1, r - 1, (mask & ~(1 << i)));
    }
  } else if (mask == 0) {
    pr(0, 0);
  }
}
int main() {
  int m, i, j, k;
  cin >> n;
  for (i = 0; i < n; i++) cin >> a[i];
  for (i = 4; i <= 12; i++) {
    d[i] = -1;
    gen(0, i - 1, (1 << n) - 1);
  }
  cout << cnt << endl;
  for (i = 1; i <= cnt; i++) {
    cout << ans[i][0] << '.' << ans[i][1] << '.' << ans[i][2] << '.'
         << ans[i][3] << endl;
  }
  return 0;
}
