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
import java.io.BufferedReader;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.util.TreeSet;


public class C {
	static int ans;
	static TreeSet<Character> TS, FORCE;
	static StringBuilder SB;
	public static void main(String[] args)throws Exception{
		FastScanner sc = new FastScanner(System.in);
		PrintWriter out = new PrintWriter(System.out);
		int N = sc.nextInt();
		if(N>6){
			System.out.println(0);
			System.exit(0);
		}
		SB = new StringBuilder("");
		ans = 0;
		boolean[] ok = new boolean[10];
		
		for(int a=0;a<N;a++){
			ok[sc.next().charAt(0)-'0']=true;
		}

		String t;
		A:for(int a=0;a<256;a++){
			t = a+"";
			for(int x=0;x<t.length();x++){
				if(!ok[t.charAt(x)-'0'])continue A;
			}
			B: for(int b=0;b<256;b++){
				t = b+"";
				for(int x=0;x<t.length();x++){
					if(!ok[t.charAt(x)-'0'])continue B;
				}
				loop: for(int c=0;c<256;c++){
					t = c+"";
					for(int x=0;x<t.length();x++){
						if(!ok[t.charAt(x)-'0'])continue loop;
					}
					
					
					String temp = a+""+b+""+c;
					for(int q=0;q<10;q++){
						if(ok[q]&&!temp.contains((char)(q+'0')+""))continue loop;
					}
					String add ="";
					add = ""+(char)temp.charAt(0);
					String temp1;
					if(valid(add)){
						temp1 = temp+add;
						if(pal(temp1))print(a,b,c,add);
					}
					add = ""+(char)temp.charAt(1)+(char)temp.charAt(0);
					if(valid(add)){
						temp1 = temp+add;
						if(pal(temp1))print(a,b,c,add);
					}
					add = ""+(char)temp.charAt(2)+(char)temp.charAt(1)+(char)temp.charAt(0);
					if(valid(add)){
						temp1 = temp+add;
						if(pal(temp1))print(a,b,c,add);
					}
				}
			}
		}
		out.println(ans);
		out.println(SB.toString());
		out.close();
	}
	private static void print(int a, int b, int c, String add) {
		ans++;
		SB.append(a+"."+b+"."+c+"."+add+"\n");
		
	}
	private static boolean valid(String thing) {
		int X = Integer.parseInt(thing);
		if(X>=256)return false;
		return thing.equals(X+"");
	}
	private static boolean pal(String temp1) {
		for(int a=0;a<temp1.length()>>1;a++){
			if(temp1.charAt(a)!=temp1.charAt(temp1.length()-1-a))return false;
		}
		return true;
	}
	static class DisjointSet {
		int[] p, r;

		DisjointSet(int s) {
			p = new int[s];
			r = new int[s];
			for (int i = 0; i < s; i++)
				p[i] = i;

		}
		
		void union(int x, int y) {
			int a = find(x);
			int b = find(y);
			if (a == b)
				return;
			if (r[a] == r[b])
				r[p[b] = a]++;
			else
				p[a] = p[b] = r[a] < r[b] ? b : a;
		}

		int find(int x) {
			return p[x] = p[x] == x ? x : find(p[x]);
		}

	}


	static class FastScanner {
		BufferedReader br;
		StringTokenizer st;
		
		public FastScanner(InputStream in) throws Exception{
			br = new BufferedReader(new InputStreamReader(in));
			st = new StringTokenizer(br.readLine().trim());
		}
		public int numTokens() throws Exception {
			if(!st.hasMoreTokens()){
				st = new StringTokenizer(br.readLine().trim());
				return numTokens();
			}
			return st.countTokens();
		}
		public String next() throws Exception {
			if(!st.hasMoreTokens()){
				st = new StringTokenizer(br.readLine().trim());
				return next();
			}
			return st.nextToken();
		}
		public double nextDouble() throws Exception{
			return Double.parseDouble(next());
		}
		public float nextFloat() throws Exception{
			return Float.parseFloat(next());
		}
		public long nextLong() throws Exception{
			return Long.parseLong(next());
		}
		public int nextInt() throws Exception{
			return Integer.parseInt(next());
		}
		public String nextLine() throws Exception{
			return br.readLine().trim();
		}
	}

}
