P9676 [AOJ] Dial
普及
题目描述

Problem

There is a dial-type padlock. This Nanjing lock has five dials and an enter button.

Rotate the five dials to create a five-digit integer in hexadecimal, press the enter button to enter it, and if the entered value and password match, it will open. For each of the five dials

0,1,2,3,4,5,6,7,8,9, a, b, c, d, e, f, 0,1,2,3,4,5,6,7,8, 9,a, b, c, d, e, f, 0,1,2, ...

It is written so that the characters appear in the order of.

The owner has forgotten the password. However, I remember that out of the five digits of the password, only one digit was even and the other four were odd. However, even numbers are 0,2,4,6,8, a, c, e, and odd numbers are 1,3,5,7,9, b, d, f.

It is also known that this key is defective and will open even if you enter a number different from the password under the following conditions. Originally, the key cannot be opened unless the entered integer and password match for all five digits. However, if the even-numbered digits of the password are the i-digits, the i-digits will match even if the odd numbers before and after the even-numbered numbers are entered when determining the match of the i-digits. It will be misjudged.

For example, if the password is a padlock of "57677", there are odd numbers of '5' and '7' before and after '6', so even if you enter "57577" or "57777" in addition to "57677" It will open. Similarly, if the password is a padlock with "130bd", when you enter "13fbd" or "131bd" in addition to "130bd" because there are odd numbers of "1" and "f" before and after "0". But it opens.

We now know that there are N password candidates, one of which is the correct password. The owner decided to enter an integer many times and keep trying until the key was unlocked. The owner wants to press the enter button as few times as possible.

How many times do you have to press the enter button when the owner takes the best strategy? Print that number. Also, output the set of integers to be input when it actually reaches the maximum in ascending order. If the answer is not uniquely determined, output the smallest one in lexicographical order.

Constraints

  • 1 ≤ N ≤ 6000
  • passwordi ≠ passwordj (i <j)
  • The string consists of 5 numbers from 0 to 9 or lowercase letters a to f, one of which is even and the other four are odd.

Input

The input is given in the following format.

N
password1
password2
...
passwordN

N is given on the first line.
The string passwordi, which represents a 5-digit hexadecimal number representing a password candidate, is given to the i-th line from the second line to the N + 1 line.

Output

Output the maximum number of times the enter button is pressed when the optimal strategy is taken before the key is unlocked on one line. Then, output the set of integers to be input at the maximum in ascending order. If the answer is not unique, output the smallest one in lexicographical order.

Examples

Input

1
0111f

Output

1
0111f

Input

3
57567
57587
0d351

Output

2
0d351
57577

Input

6
1811b
1a11b
f3b1e
f3b1c
b0df3
bedf3

Output

3
1911b
bfdf3
f3b1d

输入格式

见题面

输出格式

见题面

样例输入
3 57567 57587 0d351
样例输出
2 0d351 57577