Problem: The problem uses a simplified TCP/IP address model, please read the statement carefully.

An IP address is a 32-bit integer, represented as a group of four decimal 8-bit integers (without leading zeroes), separated by commas. For example, record 0.255.1.123 shows a correct IP address and records 0.256.1.123 and 0.255.1.01 do not. In the given problem an arbitrary group of four 8-bit integers is a correct IP address.

Our hero Polycarpus still works as a system administrator in some large corporation. He likes beautiful IP addresses. To check if some IP address is beautiful, he should do the following:

  1. write out in a line four 8-bit numbers of the IP address, without the commas; 
  2. check if the resulting string is a palindrome. 



Let us remind you that a palindrome is a string that reads the same from right to left and from left to right.

For example, IP addresses 12.102.20.121 and 0.3.14.130 are beautiful (as strings "1210220121" and "0314130" are palindromes), and IP addresses 1.20.20.1 and 100.4.4.1 are not.

Polycarpus wants to find all beautiful IP addresses that have the given set of digits. Each digit from the set must occur in the IP address at least once. IP address must not contain any other digits. Help him to cope with this difficult task.

Input

The first line contains a single integer n (1 ≤ n ≤ 10) — the number of digits in the set. The second line contains the set of integers a1, a2, ..., an (0 ≤ ai ≤ 9). It is guaranteed that all digits in the set are distinct.

Output

In the first line print a single integer k — the number of beautiful IP addresses that contain the given set of digits. In the following k lines print the IP addresses, one per line in the arbitrary order.

Examples

Input

6
0 1 2 9 8 7


Output

6
78.190.209.187
79.180.208.197
87.190.209.178
89.170.207.198
97.180.208.179
98.170.207.189


Input

1
4


Output

16
4.4.4.4
4.4.4.44
4.4.44.4
4.4.44.44
4.44.4.4
4.44.4.44
4.44.44.4
4.44.44.44
44.4.4.4
44.4.4.44
44.4.44.4
44.4.44.44
44.44.4.4
44.44.4.44
44.44.44.4
44.44.44.44

Solution (in CPP):

Solution:
#include <bits/stdc++.h>
using namespace std;
long long v[1000], f[1000], n, vis[10000], anss, i, o;
struct node {
  long long a[10];
} ans[100000];
long long calc(long long l, long long r) {
  long long tmp = 0, p = 1;
  for (long long i = r; i >= l; i--) {
    tmp += v[i] * p;
    p = p * 10;
  }
  return tmp;
}
bool pan(long long l, long long r) {
  if (l == r && v[l] == 0) return true;
  if (v[l] == 0) return false;
  long long tmp = 0, p = 1;
  for (long long i = r; i >= l; i--) {
    tmp += v[i] * p;
    p = p * 10;
  }
  if (tmp < 256) return true;
  return false;
}
void check(long long y) {
  for (long long i = 1; i <= y / 2; i++) v[y - i + 1] = v[i];
  for (long long i = 0; i <= 10; i++) vis[i] = 0;
  if (v[1] == 0 && v[2] == 1 && v[3] == 8 && v[4] == 9) v[1] = v[1];
  long long cnt = 0;
  for (long long i = 1; i <= y / 2 + 1; i++)
    if (vis[v[i]] == 0) vis[v[i]] = 1, cnt++;
  if (cnt != n) return;
  for (long long a = 1; a <= y - 3; a++) {
    if (!pan(1, a)) continue;
    for (long long b = a + 1; b <= y - 2; b++) {
      if (!pan(a + 1, b)) continue;
      for (long long c = b + 1; c <= y - 1; c++) {
        if (!pan(b + 1, c)) continue;
        if (!pan(c + 1, y)) continue;
        anss++;
        ans[anss].a[1] = calc(1, a);
        ans[anss].a[2] = calc(a + 1, b);
        ans[anss].a[3] = calc(b + 1, c);
        ans[anss].a[4] = calc(c + 1, y);
        if (ans[anss].a[1] == 0 && ans[anss].a[2] == 18 && ans[anss].a[3] == 98)
          n = n;
      }
    }
  }
}
void dfs(long long x, long long y) {
  if (x == y / 2 + 2) {
    check(y);
    return;
  }
  for (long long k = 0; k <= 10; k++) {
    if (f[k]) v[x] = k, dfs(x + 1, y);
  }
}
bool cmp(node x, node y) {
  if (x.a[1] == y.a[1]) {
    if (x.a[2] == y.a[2]) {
      if (x.a[3] == y.a[3]) {
        return x.a[4] < y.a[4];
      }
      return x.a[3] < y.a[3];
    }
    return x.a[2] < y.a[2];
  }
  return x.a[1] < y.a[1];
}
int main() {
  scanf("%I64d", &n);
  for (i = 1; i <= n; i++) {
    scanf("%I64d", &o), f[o] = 1;
  }
  for (i = 4; i <= 12; i++) {
    dfs(1, i);
  }
  sort(ans + 1, ans + anss + 1, cmp);
  int t = 0;
  ans[0].a[1] = -1;
  for (i = 1; i <= anss; i++)
    if (ans[i].a[1] != ans[i - 1].a[1] || ans[i].a[2] != ans[i - 1].a[2] ||
        ans[i].a[3] != ans[i - 1].a[3] || ans[i].a[4] != ans[i - 1].a[4])
      t++;
  cout << t << endl;
  for (i = 1; i <= anss; i++)
    if (ans[i].a[1] != ans[i - 1].a[1] || ans[i].a[2] != ans[i - 1].a[2] ||
        ans[i].a[3] != ans[i - 1].a[3] || ans[i].a[4] != ans[i - 1].a[4])
      printf("%I64d.%I64d.%I64d.%I64d\n", ans[i].a[1], ans[i].a[2], ans[i].a[3],
             ans[i].a[4]);
}