Minimum count of consecutive integers till N whose bitwise AND is 0 with N | Function to count the minimum count of integers such that bitwise AND of that many consecutive elements is equal to 0 ; Stores the binary representation of N ; Excludes first two characters "0b " ; Stores the MSB bit ; Stores the count of numbers ; Return res ; Driver Code Given Input ; Function Call
def count ( N ) : NEW_LINE INDENT a = bin ( N ) NEW_LINE a = a [ 2 : ] NEW_LINE m = len ( a ) - 1 NEW_LINE res = N - ( 2 ** m - 1 ) NEW_LINE return res NEW_LINE DEDENT N = 18 NEW_LINE print ( count ( N ) ) NEW_LINE