Jamie and Binary Sequence (changed after round)

CodeForces - 916B