Problem: Little walrus Fangy loves math very much. That's why when he is bored he plays with a number performing some operations.

Fangy takes some positive integer x and wants to get a number one from it. While x is not equal to 1, Fangy repeats the following action: if x is odd, then he adds 1 to it, otherwise he divides x by 2. Fangy knows that for any positive integer number the process ends in finite time.

How many actions should Fangy perform to get a number one from number x?

Input

The first line contains a positive integer x in a binary system. It is guaranteed that the first digit of x is different from a zero and the number of its digits does not exceed 106.

Output

Print the required number of actions.

Examples

Input

1


Output

0


Input

1001001


Output

12


Input

101110


Output

8

Note

Let's consider the third sample. Number 101110 is even, which means that we should divide it by 2. After the dividing Fangy gets an odd number 10111 and adds one to it. Number 11000 can be divided by 2 three times in a row and get number 11. All that's left is to increase the number by one (we get 100), and then divide it by 2 two times in a row. As a result, we get 1.

Solution (in JAVA):

Solution:
import java.util.*;
import java.math.*;
import java.io.*;
import java.text.*; 
 public class A{

    static FastReader scan=new FastReader();
   public static PrintWriter out = new PrintWriter (new BufferedOutputStream(System.out));
  



static int d,n,m; 
static int arr[];
static int findMaxOddSubarraySum(int arr[], int n) 
{ 
    // Here min_odd is the minimum odd number  
    // (in absolute terms). Initializing with  
    // max value of int . 
    int min_odd = Integer.MAX_VALUE; 
  
    // To check if there is al-least 
    // one odd number. 
    boolean isOdd = false; 
      
    // To store sum of all positive elements 
    int sum = 0;  
    for (int i = 0 ; i < n ; i++) 
    { 
        // Adding positive number would 
        // increase the sum. 
        if (arr[i] > 0) 
            sum = sum + arr[i]; 
  
        // To find the minimum odd number 
        // (absolute) in the array. 
        if (arr[i] % 2 != 0) 
        { 
            isOdd = true; 
            if (min_odd > Math.abs(arr[i])) 
                min_odd = Math.abs(arr[i]); 
        } 
    } 
  
    // If there was no odd number 
    if (isOdd == false) 
    return 0; 
  
    // Now, sum will be either odd or even. 
    // If even, changing it to odd.  
    // As, even - odd = odd. 
    // since m is the minimum odd 
    // number(absolute). 
    if (sum % 2 == 0) 
        sum = sum - min_odd; 
  
    return sum; 
} 
static BigInteger mod=new BigInteger("2");
static BigInteger a=new BigInteger("1");
static BigInteger z=new BigInteger("0");
static long solve(BigInteger i){
    if(i.equals(a))return 0;
if(i.mod(mod).equals(z))
    return solve(i.divide(mod))+1;
else return solve(i.add(a))+1;
}
public static void main(String[] args)  throws Exception 
{
String s=scan.next();
int len=s.length();
char chars[]=s.toCharArray();
int cnt=0;
for(int i=len-1;i>0;){
    if(chars[i]=='0'){
        cnt++;
        i--;
    }
    else {
        cnt++;
        while(chars[i]=='1'&&i>0)
        {
            cnt++;
            i--;
        }
        if(i==0)
            cnt++;
        chars[i]='1';

    }
}
out.println(cnt);

 out.close();







  

}
 public static  long pow(long b, long e) {
            long r = 1;
            while (e > 0) {
                if (e % 2 == 1) r = r * b ;
                b = b * b;
                e >>= 1;
            }
            return r;
        }
private static void sort(long[] arr) {
        List<Long> list = new ArrayList<>();
        for (long object : arr) list.add(object);
        Collections.sort(list);
        for (int i = 0; i < list.size(); ++i) arr[i] = list.get(i);
    }
 public static class FastReader {
        BufferedReader br;
        StringTokenizer root;
        
 
        public FastReader() {
            br = new BufferedReader(new InputStreamReader(System.in));
        }
 
        String next() {
            while (root == null || !root.hasMoreTokens()) {
                try {
                    root = new StringTokenizer(br.readLine());
                } catch (Exception addd) {
                    addd.printStackTrace();
                }
            }
            return root.nextToken();
        }
 
        int nextInt() {
            return Integer.parseInt(next());
        }
 
        double nextDouble() {
            return Double.parseDouble(next());
        }
 
        long nextLong() {
            return Long.parseLong(next());
        }
 
        String nextLine() {
            String str = "";
            try {
                str = br.readLine();
            } catch (Exception addd) {
                addd.printStackTrace();
            }
            return str;
        }
         public int[] nextIntArray(int arraySize) {
            int array[] = new int[arraySize];
 
            for (int i = 0; i < arraySize; i++) {
                array[i] = nextInt();
            }
 
            return array;
        }
}
static class pair{
    int i;
    int j;
pair(int i,int j){
    this.i=i;
    this.j=j;
}

}}