LearnPy Hub
← Arena
EasyRating 900

Counting Stairways

A girl climbs stairways and counts aloud 1, 2, …, k on each stairway, starting again at 1 on the next. Given everything she said, print how many stairways there were, then their step counts.

Input

n, then n numbers she said.

Output

The count, then the step counts.

Sample 1

Input
7
1 2 3 1 2 3 4
Output
2
3 4

Sample 2

Input
4
1 1 1 1
Output
4
1 1 1 1
solution.py
Output appears here
Counting Stairways · Python Arena problem · LearnPy Hub