Package for this problem was not updated by the problem writer or Codeforces administration after we’ve upgraded the judging servers. To adjust the time limit constraint, solution execution time will be multiplied by 2. For example, if your solution works for 400 ms on judging servers, then value 800 ms will be displayed and used to determine the verdict.

Virtual contest is a way to take part in past contest, as close as possible to participation on time. It is supported only ACM-ICPC mode for virtual contests.
If you've seen these problems, a virtual contest is not for you - solve these problems in the archive.
If you just want to solve some problem from a contest, a virtual contest is not for you - solve this problem in the archive.
Never use someone else's code, read the tutorials or communicate with other person during a virtual contest.

No tag edit access

E. Beautiful Decomposition

time limit per test

2 secondsmemory limit per test

256 megabytesinput

standard inputoutput

standard outputValera considers a number beautiful, if it equals 2^{k} or -2^{k} for some integer *k* (*k* ≥ 0). Recently, the math teacher asked Valera to represent number *n* as the sum of beautiful numbers. As Valera is really greedy, he wants to complete the task using as few beautiful numbers as possible.

Help Valera and find, how many numbers he is going to need. In other words, if you look at all decompositions of the number *n* into beautiful summands, you need to find the size of the decomposition which has the fewest summands.

Input

The first line contains string *s* (1 ≤ |*s*| ≤ 10^{6}), that is the binary representation of number *n* without leading zeroes (*n* > 0).

Output

Print a single integer — the minimum amount of beautiful numbers that give a total of *n*.

Examples

Input

10

Output

1

Input

111

Output

2

Input

1101101

Output

4

Note

In the first sample *n* = 2 is a beautiful number.

In the second sample *n* = 7 and Valera can decompose it into sum 2^{3} + ( - 2^{0}).

In the third sample *n* = 109 can be decomposed into the sum of four summands as follows: 2^{7} + ( - 2^{4}) + ( - 2^{2}) + 2^{0}.

Codeforces (c) Copyright 2010-2017 Mike Mirzayanov

The only programming contests Web 2.0 platform

Server time: Mar/30/2017 09:45:39 (c3).

Desktop version, switch to mobile version.
User lists

Name |
---|