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

/**
 * User: Oleksiy Pylypenko
 * Date: 1/6/13
 * Time: 1:46 PM
 */
public class R1C {
    static boolean debug = !"true".equalsIgnoreCase(System.getProperty("ONLINE_JUDGE"));
    private final String inFile = getClass().getName() + ".in";
    private final String outFile = getClass().getName() + ".out";

    private BufferedReader in;
    private StringTokenizer tok;
    private PrintWriter out;

    Set<String> set = new HashSet<String>();

    private void solve() throws IOException {
        set.clear();

        nextLine();
        int n = readInt();
        int digits = 0;
        nextLine();
        for (int i = 0; i < n; i++) {
            digits |= 1 << readInt();
        }


        StringBuffer buf = new StringBuffer();
        if (digits == 1) {
            buf.append("0000");
            tryBuf(buf);
        }
        next: for (int i = 0; i < 1000000; i++) {
            String str = Integer.toString(i);
            int dg = 0;
            for (int k = 0; k < str.length(); k++) {
                dg |= 1 << (str.charAt(k) - '0');
            }
            if ((dg | 1) == digits) {
                buf.setLength(0);
                buf.append(str);
                buf.insert(0, '0');
                buf.reverse();
                buf.insert(0, str);
                buf.insert(0, '0');

                tryBuf(buf);
                buf.setLength(0);
                buf.append(str);
                buf.insert(0, '0');
                buf.reverse();
                buf.insert(0, str.substring(0, str.length() - 1));
                buf.insert(0, '0');

                tryBuf(buf);

                buf.setLength(0);
                buf.append(str);
                buf.insert(0, '0');
                buf.insert(0, '0');
                buf.reverse();
                buf.insert(0, str);
                buf.insert(0, '0');
                buf.insert(0, '0');

                tryBuf(buf);
                buf.setLength(0);
                buf.append(str);
                buf.insert(0, '0');
                buf.insert(0, '0');
                buf.reverse();
                buf.insert(0, str.substring(0, str.length() - 1));
                buf.insert(0, '0');
                buf.insert(0, '0');

                tryBuf(buf);
            }

            if (dg != digits) {
                continue;
            }

            buf.setLength(0);
            buf.append(str);
            buf.reverse();
            buf.insert(0, str);
            tryBuf(buf);

            buf.setLength(0);
            buf.append(str);
            buf.reverse();
            buf.insert(0, str.substring(0, str.length() - 1));

            tryBuf(buf);
//            buf.insert(0, s);
//
//            buf.insert(s1 + s2, ".");
//            buf.insert(s1, ".");
        }

        out.println(set.size());
        for (String s : set) {
            out.println(s);
        }
    }

    private void tryBuf(StringBuffer buf) {
        int ll = buf.length();
        for (int s1 = 1; s1 <= 3 && s1 <= ll; s1++) {
            int pos = ll - s1;
            if (checkBlock(buf, pos, s1)) {
                continue;
            }
            for (int s2 = 1; s2 <= 3 && s1 + s2 <= ll; s2++) {
                pos = ll - s1 - s2;
                if (checkBlock(buf, pos, s2)) {
                    continue;
                }
                for (int s3 = 1; s3 <= 3 && s1 + s2 + s3 <= ll; s3++) {
                    pos = ll - s1 - s2 - s3;
                    if (checkBlock(buf, pos, s3)) {
                        continue;
                    }
                    int s4 = ll - (s1 + s2 + s3);
                    if (s4 <= 0 || s4 > 3) {
                        continue;
                    }

                    pos = 0;
                    if (checkBlock(buf, pos, s4)) {
                        continue;
                    }

                    String res = buf.substring(ll - s1 - s2 - s3 - s4, ll - s1 - s2 - s3) + "." +
                        buf.substring(ll - s1 - s2 - s3, ll - s1 - s2) + "." +
                        buf.substring(ll - s1 - s2, ll - s1) + "." +
                        buf.substring(ll - s1);

                    set.add(res);
                }
            }
        }
    }

    private boolean checkBlock(StringBuffer buf, int pos, int len) {
        if (len >= 2) {
            if (buf.charAt(pos) == '0') {
                return true;
            }
        }
        if (len == 3) {
            if (Integer.parseInt(buf.substring(pos, pos + len)) >= 256) {
                return true;
            }
        }
        return false;
    }

    private String readLine() throws IOException {return in.readLine();}
    private void nextLine() throws IOException {tok = new StringTokenizer(readLine());}

    private String read() {return tok.nextToken();}
    private int readInt() {return Integer.parseInt(read());}
    private long readLong() {return Long.parseLong(read());}
    private double readDouble() {return Double.parseDouble(read());}

    public static void main(String[] args) throws IOException {
        new R1C().exec();
    }

    private void exec() {
        openFiles();
        processSolution();
        if (debug) {
            outputOutput();
        }
    }

    private void processSolution() {
        try {
            if (debug) {
                in.mark(1000);
                while (in.read() != -1) {
                    in.reset();
                    solve();
                    in.mark(1000);
                }
            } else {
                solve();
            }
        } catch (IOException e) {
            System.out.println(e);
            System.exit(1);
        } finally {
            out.close();
            try {
                in.close();
            } catch (IOException e) {
                System.out.println(e);
                System.exit(1);
            }
        }
    }

    private void openFiles() {
        try {
            if (debug) {
                in = new BufferedReader(new FileReader(inFile));
                out = new PrintWriter(new FileWriter(outFile), true);
            } else {
                in = new BufferedReader(new InputStreamReader(System.in));
                out = new PrintWriter(System.out, true);
            }
        } catch (IOException e) {
            System.out.println(e);
            System.exit(1);
        }
    }


    private void outputOutput() {
        try {
            FileInputStream input = new FileInputStream(outFile);
            byte []buf = new byte[1024];
            int r;
            while ((r = input.read(buf)) != -1) {
                System.out.write(buf, 0, r);
            }
            input.close();
        } catch (IOException e) {
            System.out.println(e);
            System.exit(1);
        }
    }

}
