LearnPy Hub
← Arena
EasyRating 1000

Binary Gap

In the binary form of n, find the longest run of 0s that has a 1 on both sides. Print its length (0 if none).

Input

One integer n (1 ≤ n ≤ 10¹⁸).

Output

One integer.

Sample 1

Input
9
Output
2

Sample 2

Input
529
Output
4
solution.py
Output appears here
Binary Gap · Python Arena problem · LearnPy Hub