import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner a = new Scanner(System.in);
        int s1 = a.nextInt();
        a.close();
        if (s1 - 111 == 0) {
            System.out.print("3");
        }
        if (s1 - 110 == 0) {
            System.out.print("2");
        }
        if (s1 - 101 == 0) {
            System.out.print("2");
        }
        if (s1 - 100 == 0) {
            System.out.print("1");
        }
        if (s1 - 11 == 0) {
            System.out.print("2");
        }
        if (s1 - 10 == 0) {
            System.out.print("1");
        }
        if (s1 - 1 == 0) {
            System.out.print("1");
        }
        if (s1 - 0 == 0) {
            System.out.print("0");
        }
    }
} import java.util.Scanner; Scanner java.util public class Main {
    public static void main(String[] args) {
        Scanner a = new Scanner(System.in);
        int s1 = a.nextInt();
        a.close();
        if (s1 - 111 == 0) {
            System.out.print("3");
        }
        if (s1 - 110 == 0) {
            System.out.print("2");
        }
        if (s1 - 101 == 0) {
            System.out.print("2");
        }
        if (s1 - 100 == 0) {
            System.out.print("1");
        }
        if (s1 - 11 == 0) {
            System.out.print("2");
        }
        if (s1 - 10 == 0) {
            System.out.print("1");
        }
        if (s1 - 1 == 0) {
            System.out.print("1");
        }
        if (s1 - 0 == 0) {
            System.out.print("0");
        }
    }
} Main public static void main(String[] args) {
        Scanner a = new Scanner(System.in);
        int s1 = a.nextInt();
        a.close();
        if (s1 - 111 == 0) {
            System.out.print("3");
        }
        if (s1 - 110 == 0) {
            System.out.print("2");
        }
        if (s1 - 101 == 0) {
            System.out.print("2");
        }
        if (s1 - 100 == 0) {
            System.out.print("1");
        }
        if (s1 - 11 == 0) {
            System.out.print("2");
        }
        if (s1 - 10 == 0) {
            System.out.print("1");
        }
        if (s1 - 1 == 0) {
            System.out.print("1");
        }
        if (s1 - 0 == 0) {
            System.out.print("0");
        }
    } main {
        Scanner a = new Scanner(System.in);
        int s1 = a.nextInt();
        a.close();
        if (s1 - 111 == 0) {
            System.out.print("3");
        }
        if (s1 - 110 == 0) {
            System.out.print("2");
        }
        if (s1 - 101 == 0) {
            System.out.print("2");
        }
        if (s1 - 100 == 0) {
            System.out.print("1");
        }
        if (s1 - 11 == 0) {
            System.out.print("2");
        }
        if (s1 - 10 == 0) {
            System.out.print("1");
        }
        if (s1 - 1 == 0) {
            System.out.print("1");
        }
        if (s1 - 0 == 0) {
            System.out.print("0");
        }
    } Scanner a = new Scanner(System.in); a new Scanner(System.in) int s1 = a.nextInt(); s1 a.nextInt() a.nextInt a a.close() a.close a if (s1 - 111 == 0) {
            System.out.print("3");
        } s1 - 111 == 0 s1 - 111 s1 111 0 {
            System.out.print("3");
        } System.out.print("3") System.out.print System.out System System.out "3" if (s1 - 110 == 0) {
            System.out.print("2");
        } s1 - 110 == 0 s1 - 110 s1 110 0 {
            System.out.print("2");
        } System.out.print("2") System.out.print System.out System System.out "2" if (s1 - 101 == 0) {
            System.out.print("2");
        } s1 - 101 == 0 s1 - 101 s1 101 0 {
            System.out.print("2");
        } System.out.print("2") System.out.print System.out System System.out "2" if (s1 - 100 == 0) {
            System.out.print("1");
        } s1 - 100 == 0 s1 - 100 s1 100 0 {
            System.out.print("1");
        } System.out.print("1") System.out.print System.out System System.out "1" if (s1 - 11 == 0) {
            System.out.print("2");
        } s1 - 11 == 0 s1 - 11 s1 11 0 {
            System.out.print("2");
        } System.out.print("2") System.out.print System.out System System.out "2" if (s1 - 10 == 0) {
            System.out.print("1");
        } s1 - 10 == 0 s1 - 10 s1 10 0 {
            System.out.print("1");
        } System.out.print("1") System.out.print System.out System System.out "1" if (s1 - 1 == 0) {
            System.out.print("1");
        } s1 - 1 == 0 s1 - 1 s1 1 0 {
            System.out.print("1");
        } System.out.print("1") System.out.print System.out System System.out "1" if (s1 - 0 == 0) {
            System.out.print("0");
        } s1 - 0 == 0 s1 - 0 s1 0 0 {
            System.out.print("0");
        } System.out.print("0") System.out.print System.out System System.out "0" String[] args args public class Main {
    public static void main(String[] args) {
        Scanner a = new Scanner(System.in);
        int s1 = a.nextInt();
        a.close();
        if (s1 - 111 == 0) {
            System.out.print("3");
        }
        if (s1 - 110 == 0) {
            System.out.print("2");
        }
        if (s1 - 101 == 0) {
            System.out.print("2");
        }
        if (s1 - 100 == 0) {
            System.out.print("1");
        }
        if (s1 - 11 == 0) {
            System.out.print("2");
        }
        if (s1 - 10 == 0) {
            System.out.print("1");
        }
        if (s1 - 1 == 0) {
            System.out.print("1");
        }
        if (s1 - 0 == 0) {
            System.out.print("0");
        }
    }
} public class Main {
    public static void main(String[] args) {
        Scanner a = new Scanner(System.in);
        int s1 = a.nextInt();
        a.close();
        if (s1 - 111 == 0) {
            System.out.print("3");
        }
        if (s1 - 110 == 0) {
            System.out.print("2");
        }
        if (s1 - 101 == 0) {
            System.out.print("2");
        }
        if (s1 - 100 == 0) {
            System.out.print("1");
        }
        if (s1 - 11 == 0) {
            System.out.print("2");
        }
        if (s1 - 10 == 0) {
            System.out.print("1");
        }
        if (s1 - 1 == 0) {
            System.out.print("1");
        }
        if (s1 - 0 == 0) {
            System.out.print("0");
        }
    }
} Main
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner a = new Scanner(System.in);
        int s1 = a.nextInt();
        a.close();
        if (s1 - 111 == 0) {
            System.out.print("3");
        }
        if (s1 - 110 == 0) {
            System.out.print("2");
        }
        if (s1 - 101 == 0) {
            System.out.print("2");
        }
        if (s1 - 100 == 0) {
            System.out.print("1");
        }
        if (s1 - 11 == 0) {
            System.out.print("2");
        }
        if (s1 - 10 == 0) {
            System.out.print("1");
        }
        if (s1 - 1 == 0) {
            System.out.print("1");
        }
        if (s1 - 0 == 0) {
            System.out.print("0");
        }
    }
}
