import java.util.*;
public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int s = sc.nextInt();
    if(s==111){
      System.out.println(3);
    }else if(s==101||s==11||s==110){
      System.out.println(2);
    }else if(s==0){
      System.out.println(0);
    }else{
      System.out.println(1);
    }
  }
  

  
} import java.util.*; util.* java public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int s = sc.nextInt();
    if(s==111){
      System.out.println(3);
    }else if(s==101||s==11||s==110){
      System.out.println(2);
    }else if(s==0){
      System.out.println(0);
    }else{
      System.out.println(1);
    }
  }
  

  
} Main public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int s = sc.nextInt();
    if(s==111){
      System.out.println(3);
    }else if(s==101||s==11||s==110){
      System.out.println(2);
    }else if(s==0){
      System.out.println(0);
    }else{
      System.out.println(1);
    }
  } main {
    Scanner sc = new Scanner(System.in);
    int s = sc.nextInt();
    if(s==111){
      System.out.println(3);
    }else if(s==101||s==11||s==110){
      System.out.println(2);
    }else if(s==0){
      System.out.println(0);
    }else{
      System.out.println(1);
    }
  } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int s = sc.nextInt(); s sc.nextInt() sc.nextInt sc if(s==111){
      System.out.println(3);
    }else if(s==101||s==11||s==110){
      System.out.println(2);
    }else if(s==0){
      System.out.println(0);
    }else{
      System.out.println(1);
    } s==111 s 111 {
      System.out.println(3);
    } System.out.println(3) System.out.println System.out System System.out 3 if(s==101||s==11||s==110){
      System.out.println(2);
    }else if(s==0){
      System.out.println(0);
    }else{
      System.out.println(1);
    } s==101||s==11||s==110 s==101||s==11||s==110 s==101 s 101 s==11 s 11 s==110 s 110 {
      System.out.println(2);
    } System.out.println(2) System.out.println System.out System System.out 2 if(s==0){
      System.out.println(0);
    }else{
      System.out.println(1);
    } s==0 s 0 {
      System.out.println(0);
    } System.out.println(0) System.out.println System.out System System.out 0 {
      System.out.println(1);
    } System.out.println(1) System.out.println System.out System System.out 1 String[] args args public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int s = sc.nextInt();
    if(s==111){
      System.out.println(3);
    }else if(s==101||s==11||s==110){
      System.out.println(2);
    }else if(s==0){
      System.out.println(0);
    }else{
      System.out.println(1);
    }
  }
  

  
} public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int s = sc.nextInt();
    if(s==111){
      System.out.println(3);
    }else if(s==101||s==11||s==110){
      System.out.println(2);
    }else if(s==0){
      System.out.println(0);
    }else{
      System.out.println(1);
    }
  }
  

  
} Main
import java.util.*;
public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int s = sc.nextInt();
    if(s==111){
      System.out.println(3);
    }else if(s==101||s==11||s==110){
      System.out.println(2);
    }else if(s==0){
      System.out.println(0);
    }else{
      System.out.println(1);
    }
  }
  

  
}