#C6545. Minimum Days for All Flowers to Bloom

    ID: 50317 Type: Default 1000ms 256MiB

Minimum Days for All Flowers to Bloom

Minimum Days for All Flowers to Bloom

You are given an integer ( n ) representing the number of flowers and a list of ( n ) integers where each integer represents the state of a flower. A state of ( 1 ) indicates that the flower is blooming, and a state of ( 0 ) indicates that it is not blooming. In one day, you can only get a flower to bloom if its current state is ( 0 ). Your task is to determine the minimum number of days required for all flowers to bloom at least once. Essentially, you need to count the number of flowers that are not blooming, since each non-blooming flower requires one day to bloom.

Input Example: For an input of ( n = 5 ) and flower states ( [1, 0, 0, 1, 0] ), the answer would be 3 because three flowers are not blooming.

inputFormat

The input is given via standard input (stdin). The first line contains a single integer ( n ) representing the number of flowers. The second line contains ( n ) integers separated by spaces, where each integer is either ( 0 ) (not blooming) or ( 1 ) (blooming).

outputFormat

The output is a single integer printed to standard output (stdout) representing the minimum number of days required for all the flowers to bloom (i.e., the count of flowers that are not blooming).## sample

5
1 0 0 1 0
3

</p>