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 JAVA):

Solution:
import java.util.*;
import java.io.*;
import java.math.*;

public class Main {
	public static void main(String[] args) {
		InputStream inputStream = System.in;
		OutputStream outputStream = System.out;
		InputReader in = new InputReader(inputStream);
		PrintWriter out = new PrintWriter(outputStream);
		Solver solver = new Solver();
		solver.solve(in, out);
		out.close();
	}
}


class Solver {
	char[] good;
	int[] num;
	ArrayList<String> ans;
	int[] d;
	boolean good(String s) {
		if (s.length() == 0)
			return false;
		if (s.length() > 1 && s.charAt(0) == '0')
			return false;
		int w = Integer.parseInt(s);
		if (w > 255)
			return false;
		return true;
	}
	void split(String s, int p, int cd) {
		if (cd == 3) {
			if (s.length() - p > 3)
				return;
			if (!good(s.substring(d[3])))
				return;
			StringBuffer res = new StringBuffer();
			for (int i = 0; i < 3; i++) {
				res.append(s.substring(d[i], d[i + 1]));
				res.append('.');
			}
			res.append(s.substring(d[3]));
			ans.add(res.toString());
			return;
		}
		for (int i = 1; i <= 3; i++) {
			if (p + i > s.length())
				break;
			if (good(s.substring(d[cd], d[cd] + i))) {
				d[cd + 1] = d[cd] + i;
				split(s, p + i, cd + 1);
			}
		}
		return;
	}
	void check(String s) {
//		System.err.println(s);
		for (int i = 0; i < num.length; i++) {
			if (num[i] == 0)
				return;
		}
		split(s, 0, 0);
	}
	void gen(int l, StringBuffer s) {
		if (l == 0) {
			String w = s.toString() + s.reverse().toString();
			check(w);
			w = s.toString() + s.reverse().substring(1);
			check(w);
			return;
		}
		for (int i = 0; i < good.length; ++i) {
			s.append(good[i]);
			num[i]++;
			gen(l - 1, s);
			s.deleteCharAt(s.length() - 1);
			num[i]--;
		}
	}
	public void solve(InputReader in, PrintWriter out) {
		int c = in.nextInt();
		good = new char[c];
		num = new int[c];
		for (int i = 0; i < c; i++) {
			good[i] = new Integer(in.nextInt()).toString().charAt(0);
		}
		ans = new ArrayList<String>();
		d = new int[4];
		for (int l = 2; l <= 6; ++l) {
			gen(l, new StringBuffer());
		}
		out.println(ans.size());
		for (String s : ans) {
			out.println(s);
		}
		
	}
}

class InputReader {
	private BufferedReader reader;
	private StringTokenizer tokenizer;

	public InputReader(InputStream stream) {
		reader = new BufferedReader(new InputStreamReader(stream));
		tokenizer = null;
	}

	public String next() {
		while (tokenizer == null || !tokenizer.hasMoreTokens()) {
			try {
				tokenizer = new StringTokenizer(reader.readLine());
			} catch (IOException e) {
				throw new RuntimeException(e);
			}
		}
		return tokenizer.nextToken();
	}

	public long nextLong() {
		return Long.parseLong(next());
	}

	public int nextInt() {
		return Integer.parseInt(next());
	}

	public double nextDouble() {
		return Double.parseDouble(next());
	}
}