Олимпиадный тренинг

Задача 38188. Symmetric sequence


A sequence of numbers is said to be symmetrical if it reads the same from left to right as from right to left. For example, the following sequences are symmetrical:
1 2 3 4 5 4 3 2 1
1 2 1 2 2 1 2 1
Your program will be given a sequence of numbers. It is required to determine what is the minimum number and what numbers must be added to the end of this sequence so that it becomes symmetrical.

Input
First enter the number N — the number of elements of the original sequence (1 ≤ N ≤ 100). Next come N numbers — elements of this sequence, natural numbers from 1 to 9.

Imprint
First print the number M — the minimum number of elements to add to the sequence, followed by M numbers (each — from 1 to 9) — numbers to add to the sequence.

Examples
# Input Output
1 9
1 2 3 4 5 4 3 2 1
0
2 5
1 2 1 2 2
3
1 2 1
3 5
1 2 3 4 5
4
4 3 2 1