Array
题号:NC239489
时间限制:C/C++/Rust/Pascal 2秒,其他语言4秒
空间限制:C/C++/Rust/Pascal 256 M,其他语言512 M
Special Judge, 64bit IO Format: %lld

题目描述

Ranran has a sequence a of n integers  which satisfies and he is very proud of it, so he comes up with a problem for you.

You need to find out a sequence c of m integers . With c, you construct an infinite sequence b, and b_i equals to b must satisfy the condition that in every consecutive a_i numbers of b there exists a number equals to i.

Please note that a is 1-indexed and b, c are 0-indexed. The value of m is decided by you.

Can you solve the problem?

输入描述:

The first line contains an integer .

The second line contains n integers .

输出描述:

The first line output an integer m.

The second line output m integers .

You should guarantee that  and .
示例1

输入

复制
1
2

输出

复制
2
1 1