A dockyard's sorting robot reads a manifest listing the tag numbers stamped on a batch of shipping crates. Before routing the batch onward, the robot locates the crate with the smallest tag number, adds together the individual decimal digits of that tag, and raises a single parity flag so the downstream conveyor machinery knows whether to expect an odd or even checksum.
The first line contains a single integer n, the number of crates on the manifest. The second line contains n space-separated positive integers, the tag numbers of the crates.
A single integer: 1 if the digit sum of the smallest tag number is odd, or 0 if it is even.
Example 1
Input
8 34 23 1 24 75 33 54 8
Expected
1
Explanation
The smallest tag is 1. Its digit sum is 1, which is odd, so the flag is 1.
Example 2
Input
5 99 77 33 66 55
Expected
0
Explanation
The smallest tag is 33. Its digit sum is 3 + 3 = 6, which is even, so the flag is 0.
Ready to solve this?
Sign in to open the editor, run your code against the sample tests, and submit against the full test suite.
Sign in to solve →