#jag2018summerday2e. [jag2018summer_day2_e]Self-contained

[jag2018summer_day2_e]Self-contained

Problem Statement

Ao loves certain sets of non-negative integers.

Let XX be a set of non-negative integers. Whether she loves XX or not is determined as follows:

  • If XX is the empty set, she loves XX.
  • If, for any (possibly the same) two elements uu and vv in XX, at least one of u+vu+v and rmabs(uv){\\rm abs}(u-v) is contained in XX, she loves XX.
  • If none of the above conditions is satisfied, she does not love XX.

You are a big fan of Ao, and going to present her a set of non-negative integers. Currently you have a set AA of non-negative integers. You want to erase (possibly zero) elements from AA so that she loves the set of remaining integers. You also want to maximize the number of remaining integers. What is the largest number of remaining integers?

Constraints

  • AA is not empty.
  • The largest element in AA is not larger than 500,000500,000

Input

Input is given from Standard Input in the following format:

SS

Here, S=S0S1...SS1S=S_0S_1...S_{|S|-1} is the string which indicates AA. For each ii ( 0leqileqS10 \\leq i \\leq |S|-1 ), Si=S_i = 1 if AA contains ii and Si=S_i = 0 if not. It is guaranteed that SS1S_{|S|-1} is 1.

Output

Print the largest number of remaining integers.


Sample Input 1

1000001001011

Sample Output 1

3

The set A=0,6,9,11,12A = \\{0,6,9,11,12\\}. If you erase 99 and 1111, Ao loves the set of remaining integers: 0,6,12\\{0,6,12\\}.


Sample Input 2

10110110101

Sample Output 2

4

Sample Input 3

0111

Sample Output 3

0

The set of remaining integers must be empty.