import java.util.*;
 

public class Main {
    public static void main(String[] args) {   
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        if(s.equals("100")||s.equals("010")||s.equals("001")){
            System.out.println(1);
        }else if(s.equals("011")||s.equals("101")||s.equals("110")){
        System.out.println(2);
        }else if(s.equals("000")){
        System.out.println(0);
        }else if(s.equals("111")){
            System.out.println(3);
        }


		
    }
}
 import java.util.*; util.* java public class Main {
    public static void main(String[] args) {   
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        if(s.equals("100")||s.equals("010")||s.equals("001")){
            System.out.println(1);
        }else if(s.equals("011")||s.equals("101")||s.equals("110")){
        System.out.println(2);
        }else if(s.equals("000")){
        System.out.println(0);
        }else if(s.equals("111")){
            System.out.println(3);
        }


		
    }
} Main public static void main(String[] args) {   
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        if(s.equals("100")||s.equals("010")||s.equals("001")){
            System.out.println(1);
        }else if(s.equals("011")||s.equals("101")||s.equals("110")){
        System.out.println(2);
        }else if(s.equals("000")){
        System.out.println(0);
        }else if(s.equals("111")){
            System.out.println(3);
        }


		
    } main {   
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        if(s.equals("100")||s.equals("010")||s.equals("001")){
            System.out.println(1);
        }else if(s.equals("011")||s.equals("101")||s.equals("110")){
        System.out.println(2);
        }else if(s.equals("000")){
        System.out.println(0);
        }else if(s.equals("111")){
            System.out.println(3);
        }


		
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) String s = sc.next(); s sc.next() sc.next sc if(s.equals("100")||s.equals("010")||s.equals("001")){
            System.out.println(1);
        }else if(s.equals("011")||s.equals("101")||s.equals("110")){
        System.out.println(2);
        }else if(s.equals("000")){
        System.out.println(0);
        }else if(s.equals("111")){
            System.out.println(3);
        } s.equals("100")||s.equals("010")||s.equals("001") s.equals("100")||s.equals("010")||s.equals("001") s.equals("100") s.equals s "100" s.equals("010") s.equals s "010" s.equals("001") s.equals s "001" {
            System.out.println(1);
        } System.out.println(1) System.out.println System.out System System.out 1 if(s.equals("011")||s.equals("101")||s.equals("110")){
        System.out.println(2);
        }else if(s.equals("000")){
        System.out.println(0);
        }else if(s.equals("111")){
            System.out.println(3);
        } s.equals("011")||s.equals("101")||s.equals("110") s.equals("011")||s.equals("101")||s.equals("110") s.equals("011") s.equals s "011" s.equals("101") s.equals s "101" s.equals("110") s.equals s "110" {
        System.out.println(2);
        } System.out.println(2) System.out.println System.out System System.out 2 if(s.equals("000")){
        System.out.println(0);
        }else if(s.equals("111")){
            System.out.println(3);
        } s.equals("000") s.equals s "000" {
        System.out.println(0);
        } System.out.println(0) System.out.println System.out System System.out 0 if(s.equals("111")){
            System.out.println(3);
        } s.equals("111") s.equals s "111" {
            System.out.println(3);
        } System.out.println(3) System.out.println System.out System System.out 3 String[] args args public class Main {
    public static void main(String[] args) {   
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        if(s.equals("100")||s.equals("010")||s.equals("001")){
            System.out.println(1);
        }else if(s.equals("011")||s.equals("101")||s.equals("110")){
        System.out.println(2);
        }else if(s.equals("000")){
        System.out.println(0);
        }else if(s.equals("111")){
            System.out.println(3);
        }


		
    }
} public class Main {
    public static void main(String[] args) {   
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        if(s.equals("100")||s.equals("010")||s.equals("001")){
            System.out.println(1);
        }else if(s.equals("011")||s.equals("101")||s.equals("110")){
        System.out.println(2);
        }else if(s.equals("000")){
        System.out.println(0);
        }else if(s.equals("111")){
            System.out.println(3);
        }


		
    }
} Main
import java.util.*;
 

public class Main {
    public static void main(String[] args) {   
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        if(s.equals("100")||s.equals("010")||s.equals("001")){
            System.out.println(1);
        }else if(s.equals("011")||s.equals("101")||s.equals("110")){
        System.out.println(2);
        }else if(s.equals("000")){
        System.out.println(0);
        }else if(s.equals("111")){
            System.out.println(3);
        }


		
    }
}

