A theater seats guests along a singly linked chain, positions numbered 1, 2, 3, ... from the head. Rearrange the chain so that all guests at odd positions (1st, 3rd, 5th, ...) appear first, followed by all guests at even positions (2nd, 4th, 6th, ...). Within each group, keep the original relative order. Print the resulting chain.
Input format
Line 1: an integer n, the number of nodes.
Line 2: n space-separated integers, the node values from head to tail (empty line when n is 0).
Output format
Line 1: the number of nodes, n.
Line 2: the regrouped values, space-separated (empty line if none).
Constraints
- 0 <= n <= 100000
- -1000000000 <= each value <= 1000000000