import java.io.BufferedReader;
import java.io.*;
import java.util.*;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.Collections;
public class Main {
	public static void main(final String[] args){
    
    Scanner sc = new Scanner(System.in);
    
    int a = sc.nextInt();
    int b = sc.nextInt();
    int c = sc.nextInt();
    int d = sc.nextInt();
    int e = sc.nextInt();

    if(a == 0){
        System.out.println(1);
    }else if(b == 0){
        System.out.println(2);
    }else if(c == 0){
        System.out.println(3);
    }else if(d == 0){
        System.out.println(4);
    }else{
        System.out.println(5);
    }

    


    
    


    


    
    


    
	}
} import java.io.BufferedReader; BufferedReader java.io import java.io.*; io.* java import java.util.*; util.* java import java.util.ArrayList; ArrayList java.util import java.util.Iterator; Iterator java.util import java.util.List; List java.util import java.util.Collections; Collections java.util public class Main {
	public static void main(final String[] args){
    
    Scanner sc = new Scanner(System.in);
    
    int a = sc.nextInt();
    int b = sc.nextInt();
    int c = sc.nextInt();
    int d = sc.nextInt();
    int e = sc.nextInt();

    if(a == 0){
        System.out.println(1);
    }else if(b == 0){
        System.out.println(2);
    }else if(c == 0){
        System.out.println(3);
    }else if(d == 0){
        System.out.println(4);
    }else{
        System.out.println(5);
    }

    


    
    


    


    
    


    
	}
} Main public static void main(final String[] args){
    
    Scanner sc = new Scanner(System.in);
    
    int a = sc.nextInt();
    int b = sc.nextInt();
    int c = sc.nextInt();
    int d = sc.nextInt();
    int e = sc.nextInt();

    if(a == 0){
        System.out.println(1);
    }else if(b == 0){
        System.out.println(2);
    }else if(c == 0){
        System.out.println(3);
    }else if(d == 0){
        System.out.println(4);
    }else{
        System.out.println(5);
    }

    


    
    


    


    
    


    
	} main {
    
    Scanner sc = new Scanner(System.in);
    
    int a = sc.nextInt();
    int b = sc.nextInt();
    int c = sc.nextInt();
    int d = sc.nextInt();
    int e = sc.nextInt();

    if(a == 0){
        System.out.println(1);
    }else if(b == 0){
        System.out.println(2);
    }else if(c == 0){
        System.out.println(3);
    }else if(d == 0){
        System.out.println(4);
    }else{
        System.out.println(5);
    }

    


    
    


    


    
    


    
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int a = sc.nextInt(); a sc.nextInt() sc.nextInt sc int b = sc.nextInt(); b sc.nextInt() sc.nextInt sc int c = sc.nextInt(); c sc.nextInt() sc.nextInt sc int d = sc.nextInt(); d sc.nextInt() sc.nextInt sc int e = sc.nextInt(); e sc.nextInt() sc.nextInt sc if(a == 0){
        System.out.println(1);
    }else if(b == 0){
        System.out.println(2);
    }else if(c == 0){
        System.out.println(3);
    }else if(d == 0){
        System.out.println(4);
    }else{
        System.out.println(5);
    } a == 0 a 0 {
        System.out.println(1);
    } System.out.println(1) System.out.println System.out System System.out 1 if(b == 0){
        System.out.println(2);
    }else if(c == 0){
        System.out.println(3);
    }else if(d == 0){
        System.out.println(4);
    }else{
        System.out.println(5);
    } b == 0 b 0 {
        System.out.println(2);
    } System.out.println(2) System.out.println System.out System System.out 2 if(c == 0){
        System.out.println(3);
    }else if(d == 0){
        System.out.println(4);
    }else{
        System.out.println(5);
    } c == 0 c 0 {
        System.out.println(3);
    } System.out.println(3) System.out.println System.out System System.out 3 if(d == 0){
        System.out.println(4);
    }else{
        System.out.println(5);
    } d == 0 d 0 {
        System.out.println(4);
    } System.out.println(4) System.out.println System.out System System.out 4 {
        System.out.println(5);
    } System.out.println(5) System.out.println System.out System System.out 5 final String[] args args public class Main {
	public static void main(final String[] args){
    
    Scanner sc = new Scanner(System.in);
    
    int a = sc.nextInt();
    int b = sc.nextInt();
    int c = sc.nextInt();
    int d = sc.nextInt();
    int e = sc.nextInt();

    if(a == 0){
        System.out.println(1);
    }else if(b == 0){
        System.out.println(2);
    }else if(c == 0){
        System.out.println(3);
    }else if(d == 0){
        System.out.println(4);
    }else{
        System.out.println(5);
    }

    


    
    


    


    
    


    
	}
} public class Main {
	public static void main(final String[] args){
    
    Scanner sc = new Scanner(System.in);
    
    int a = sc.nextInt();
    int b = sc.nextInt();
    int c = sc.nextInt();
    int d = sc.nextInt();
    int e = sc.nextInt();

    if(a == 0){
        System.out.println(1);
    }else if(b == 0){
        System.out.println(2);
    }else if(c == 0){
        System.out.println(3);
    }else if(d == 0){
        System.out.println(4);
    }else{
        System.out.println(5);
    }

    


    
    


    


    
    


    
	}
} Main
import java.io.BufferedReader;
import java.io.*;
import java.util.*;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.Collections;
public class Main {
	public static void main(final String[] args){
    
    Scanner sc = new Scanner(System.in);
    
    int a = sc.nextInt();
    int b = sc.nextInt();
    int c = sc.nextInt();
    int d = sc.nextInt();
    int e = sc.nextInt();

    if(a == 0){
        System.out.println(1);
    }else if(b == 0){
        System.out.println(2);
    }else if(c == 0){
        System.out.println(3);
    }else if(d == 0){
        System.out.println(4);
    }else{
        System.out.println(5);
    }

    


    
    


    


    
    


    
	}
}