import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

class Main {
    public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String[] s = br.readLine().split(" ");
        int[] arr = new int[5];
        for(int i=0; i<5; i++)
            arr[i] = Integer.parseInt(s[i]);
        
        for(int i=0; i<5; i++) {
            if(arr[i] == 0) {
                System.out.print(i+1);
                return;
            }
        }
        System.out.print(-1);
    }
} import java.io.BufferedReader; BufferedReader java.io import java.io.IOException; IOException java.io import java.io.InputStreamReader; InputStreamReader java.io class Main {
    public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String[] s = br.readLine().split(" ");
        int[] arr = new int[5];
        for(int i=0; i<5; i++)
            arr[i] = Integer.parseInt(s[i]);
        
        for(int i=0; i<5; i++) {
            if(arr[i] == 0) {
                System.out.print(i+1);
                return;
            }
        }
        System.out.print(-1);
    }
} Main public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String[] s = br.readLine().split(" ");
        int[] arr = new int[5];
        for(int i=0; i<5; i++)
            arr[i] = Integer.parseInt(s[i]);
        
        for(int i=0; i<5; i++) {
            if(arr[i] == 0) {
                System.out.print(i+1);
                return;
            }
        }
        System.out.print(-1);
    } main {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String[] s = br.readLine().split(" ");
        int[] arr = new int[5];
        for(int i=0; i<5; i++)
            arr[i] = Integer.parseInt(s[i]);
        
        for(int i=0; i<5; i++) {
            if(arr[i] == 0) {
                System.out.print(i+1);
                return;
            }
        }
        System.out.print(-1);
    } BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); br new BufferedReader(new InputStreamReader(System.in)) String[] s = br.readLine().split(" "); s br.readLine().split(" ") br.readLine().split br.readLine() br.readLine br " " int[] arr = new int[5]; arr new int[5] 5 for(int i=0; i<5; i++)
            arr[i] = Integer.parseInt(s[i]); int i=0; int i=0; i 0 i<5 i 5 i++ i++ i arr[i] = Integer.parseInt(s[i]); arr[i] = Integer.parseInt(s[i]) arr[i] arr i Integer.parseInt(s[i]) Integer.parseInt Integer s[i] s i for(int i=0; i<5; i++) {
            if(arr[i] == 0) {
                System.out.print(i+1);
                return;
            }
        } int i=0; int i=0; i 0 i<5 i 5 i++ i++ i {
            if(arr[i] == 0) {
                System.out.print(i+1);
                return;
            }
        } {
            if(arr[i] == 0) {
                System.out.print(i+1);
                return;
            }
        } if(arr[i] == 0) {
                System.out.print(i+1);
                return;
            } arr[i] == 0 arr[i] arr i 0 {
                System.out.print(i+1);
                return;
            } System.out.print(i+1) System.out.print System.out System System.out i+1 i 1 return; System.out.print(-1) System.out.print System.out System System.out -1 1 String[] args args
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

class Main {
    public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String[] s = br.readLine().split(" ");
        int[] arr = new int[5];
        for(int i=0; i<5; i++)
            arr[i] = Integer.parseInt(s[i]);
        
        for(int i=0; i<5; i++) {
            if(arr[i] == 0) {
                System.out.print(i+1);
                return;
            }
        }
        System.out.print(-1);
    }
}