Storytelling Festival#651

Storytelling Festival

2 seconds
64 megabytes
Hard

A city is hosting an annual storytelling festival. Olena, a talented storyteller, wants to participate in the competition. The festival lasts several evenings, and each evening is dedicated to exactly hours of performances.

Olena knows many interesting stories of various durations. She wants to tell as many stories as possible to impress the jury and audience.

Festival rules:

The more stories Olena tells, the more points she receives from the jury. Help Olena choose an optimal strategy to maximize the number of stories told.

Input

The first line contains an integer (1 \leq N \leq 10000) — the number of stories Olena knows. The second line contains natural numbers, each not exceeding , representing the duration of each story in hours. It is assumed that each evening lasts hours.

Output

Print in the first line the maximum number of stories Olena can tell, and in the second line their durations in the order she should tell them.

Examples

Example 1

Loading
Loading