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;
void solve();
int main() {
  string s = "change me please";
  cout.sync_with_stdio(0);
  int t = 1;
  while (t--) solve();
  return 0;
}
int n;
int need = 0;
vector<int> got;
int filled = 0;
int had = 0;
vector<vector<int> > can;
void rec() {
  if (had > 6) return;
  if (filled == need) can.push_back(got);
  for (int num = 0; num < 10; ++num)
    if (need & (1 << num)) {
      got.push_back(num);
      ++had;
      bool f = true;
      if (filled & (1 << num)) f = false;
      if (f) {
        filled |= (1 << num);
      }
      rec();
      --had;
      got.pop_back();
      if (f) {
        filled ^= (1 << num);
      }
    }
}
bool good(vector<int>& now) {
  if (now.size() == 0) return false;
  if (now.size() == 1) return true;
  if (now[0] == 0) return false;
  int cur = 0;
  for (int i = 0; i < now.size(); ++i) cur = cur * 10 + now[i];
  return cur < 256;
}
void solve() {
  cin >> n;
  for (int i = 0; i < n; ++i) {
    int cur;
    cin >> cur;
    need |= (1 << cur);
  }
  rec();
  vector<vector<int> > palindromes;
  for (int i = 0; i < can.size(); ++i) {
    vector<int> now = can[i];
    vector<int> nex = can[i];
    for (int i = now.size() - 1; i >= 0; --i) nex.push_back(now[i]);
    palindromes.push_back(nex);
    nex = can[i];
    for (int i = (int)now.size() - 2; i >= 0; --i) nex.push_back(now[i]);
    palindromes.push_back(nex);
  }
  vector<vector<vector<int> > > res;
  for (int i = 0; i < palindromes.size(); ++i) {
    int a[3];
    vector<int> now = palindromes[i];
    vector<int> first, second, third;
    for (a[0] = 0; a[0] < now.size(); ++a[0]) {
      first.push_back(now[a[0]]);
      if (!good(first)) {
        break;
      }
      second.clear();
      for (a[1] = a[0] + 1; a[1] < now.size(); ++a[1]) {
        second.push_back(now[a[1]]);
        if (!good(second)) {
          break;
        }
        third.clear();
        for (a[2] = a[1] + 1; a[2] < now.size(); ++a[2]) {
          third.push_back(now[a[2]]);
          if (!good(third)) break;
          vector<int> fourth;
          for (int j = a[2] + 1; j < now.size(); ++j) fourth.push_back(now[j]);
          if (good(fourth)) {
            vector<vector<int> > add;
            add.push_back(first);
            add.push_back(second);
            add.push_back(third);
            add.push_back(fourth);
            res.push_back(add);
          }
        }
      }
    }
  }
  cout << res.size() << "\n";
  for (int i = 0; i < res.size(); ++i) {
    for (int w = 0; w < 4; ++w) {
      for (int j = 0; j < res[i][w].size(); ++j) cout << res[i][w][j];
      if (w != 3) cout << ".";
    }
    cout << "\n";
  }
}