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.io.*;
import java.util.*;

public class C implements Runnable {
	public static void main(String[] args) {
		new Thread(new C()).run();
	}

	BufferedReader br;
	StringTokenizer in;
	PrintWriter out;

	public String nextToken() throws IOException {
		while (in == null || !in.hasMoreTokens()) {
			in = new StringTokenizer(br.readLine());
		}

		return in.nextToken();
	}

	public int nextInt() throws IOException {
		return Integer.parseInt(nextToken());
	}

	public long nextLong() throws IOException {
		return Long.parseLong(nextToken());
	}

	public double nextDouble() throws IOException {
		return Double.parseDouble(nextToken());
	}

	ArrayList<String> ans = new ArrayList<String>();
	TreeSet<String> a = new TreeSet<>();
	ArrayList<String> aa = new ArrayList<>();

	public boolean good(String z) {
		int l = 0;
		int r = z.length() - 1;
		while (l < r) {
			if (z.charAt(l) == '.')
				l++;
			if (z.charAt(r) == '.')
				r--;
			if (z.charAt(l) != z.charAt(r))
				return false;
			l++;
			r--;
		}
		return true;
	}

	public void check(char[] z) {
		String start = "";
		int t = 0;
		for (int l = 1; l <= 3; l++) {
			if (z[t] == '.')
				t++;
			start = z[t] + start;
			if (a.contains(start)) {
				String q = new String(z, 0, len) + start;
				if (good(q))
					ans.add(q);
			}
			t++;
		}
	}

	int[] have = new int[10];
	boolean[] good;
	int t = 0;
	int len = 0;
	char[] now = new char[100];

	public void gen(int k) {
		if (k == 3) {
			t++;
			have = new int[10];
			for (int i = 0; i < len; i++) {
				if (now[i] != '.')
					have[now[i] - '0'] = t;
			}

			// System.err.println(Arrays.toString(have));

			for (int i = 0; i < good.length; i++) {
				if (good[i] && !(have[i] == t))
					return;
			}

			if (new String(now).startsWith("78.190.209.")) {
				int z = 0;
				z++;
			}

			check(now);
			return;
		}

		// System.err.println(now);

		for (String z : aa) {
			for (int i = 0; i < z.length(); i++) {
				now[i + len] = z.charAt(i);
			}
			len += z.length() + 1;
			now[len - 1] = '.';
			gen(k + 1);
			len -= z.length() + 1;
		}
	}

	public void solve() throws IOException {
		int n = nextInt();

		if (n == 10) {
			out.println(0);
			return;
		}

		good = new boolean[10];
		for (int i = 0; i < n; i++) {
			good[nextInt()] = true;
		}

		for (int i = 0; i < 256; i++) {
			String q = i + "";
			boolean g = true;
			for (int j = 0; j < q.length(); j++) {
				if (!good[q.charAt(j) - '0'])
					g = false;
			}

			if (g) {
				a.add("" + i);
				aa.add("" + i);
			}
		}

		gen(0);

		out.println(ans.size());
		for (String z : ans) {
			out.println(z);
		}
	}

	public void run() {
		try {
			br = new BufferedReader(new InputStreamReader(System.in));
			out = new PrintWriter(System.out);

			solve();

			out.close();
		} catch (IOException e) {
			e.printStackTrace();
			System.exit(1);
		}
	}
}