import java.util.Scanner;

public class Main {
	public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        Main m = new Main(sc);
        m.show(m.solve());
        sc.close();
    }
    
	//フィールド
    Scanner sc;
    int[] x;
    
    //入力
    Main(Scanner sc) {
        this.sc = sc;
        this.x = new int[5];
    }
    
    //解答処理
    private int solve() {
        int answer = 0;
        for (int i=0; i<5; i++) {
        	x[i] = sc.nextInt();
        	if (x[i] == 0) {
        		answer = i+1;
        	}
        }
        
        return answer;
    }
    
    //出力
    public void show(int answer) {
        System.out.println(answer);
    }

} import java.util.Scanner; Scanner java.util public class Main {
	public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        Main m = new Main(sc);
        m.show(m.solve());
        sc.close();
    }
    
	//フィールド
    Scanner sc;
    int[] x;
    
    //入力
    Main(Scanner sc) {
        this.sc = sc;
        this.x = new int[5];
    }
    
    //解答処理
    private int solve() {
        int answer = 0;
        for (int i=0; i<5; i++) {
        	x[i] = sc.nextInt();
        	if (x[i] == 0) {
        		answer = i+1;
        	}
        }
        
        return answer;
    }
    
    //出力
    public void show(int answer) {
        System.out.println(answer);
    }

} Main //フィールド
    Scanner sc; sc int[] x; x public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        Main m = new Main(sc);
        m.show(m.solve());
        sc.close();
    } main {
        Scanner sc = new Scanner(System.in);
        Main m = new Main(sc);
        m.show(m.solve());
        sc.close();
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) Main m = new Main(sc); m new Main(sc) m.show(m.solve()) m.show m m.solve() m.solve m sc.close() sc.close sc String[] args args //入力
    Main(Scanner sc) {
        this.sc = sc;
        this.x = new int[5];
    } Main {
        this.sc = sc;
        this.x = new int[5];
    } this.sc = sc this.sc this this.sc sc this.x = new int[5] this.x this this.x new int[5] 5 Scanner sc sc //解答処理
    private int solve() {
        int answer = 0;
        for (int i=0; i<5; i++) {
        	x[i] = sc.nextInt();
        	if (x[i] == 0) {
        		answer = i+1;
        	}
        }
        
        return answer;
    } solve {
        int answer = 0;
        for (int i=0; i<5; i++) {
        	x[i] = sc.nextInt();
        	if (x[i] == 0) {
        		answer = i+1;
        	}
        }
        
        return answer;
    } int answer = 0; answer 0 for (int i=0; i<5; i++) {
        	x[i] = sc.nextInt();
        	if (x[i] == 0) {
        		answer = i+1;
        	}
        } int i=0; int i=0; i 0 i<5 i 5 i++ i++ i {
        	x[i] = sc.nextInt();
        	if (x[i] == 0) {
        		answer = i+1;
        	}
        } {
        	x[i] = sc.nextInt();
        	if (x[i] == 0) {
        		answer = i+1;
        	}
        } x[i] = sc.nextInt() x[i] x i sc.nextInt() sc.nextInt sc if (x[i] == 0) {
        		answer = i+1;
        	} x[i] == 0 x[i] x i 0 {
        		answer = i+1;
        	} answer = i+1 answer i+1 i 1 return answer; answer //出力
    public void show(int answer) {
        System.out.println(answer);
    } show {
        System.out.println(answer);
    } System.out.println(answer) System.out.println System.out System System.out answer int answer answer public class Main {
	public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        Main m = new Main(sc);
        m.show(m.solve());
        sc.close();
    }
    
	//フィールド
    Scanner sc;
    int[] x;
    
    //入力
    Main(Scanner sc) {
        this.sc = sc;
        this.x = new int[5];
    }
    
    //解答処理
    private int solve() {
        int answer = 0;
        for (int i=0; i<5; i++) {
        	x[i] = sc.nextInt();
        	if (x[i] == 0) {
        		answer = i+1;
        	}
        }
        
        return answer;
    }
    
    //出力
    public void show(int answer) {
        System.out.println(answer);
    }

} public class Main {
	public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        Main m = new Main(sc);
        m.show(m.solve());
        sc.close();
    }
    
	//フィールド
    Scanner sc;
    int[] x;
    
    //入力
    Main(Scanner sc) {
        this.sc = sc;
        this.x = new int[5];
    }
    
    //解答処理
    private int solve() {
        int answer = 0;
        for (int i=0; i<5; i++) {
        	x[i] = sc.nextInt();
        	if (x[i] == 0) {
        		answer = i+1;
        	}
        }
        
        return answer;
    }
    
    //出力
    public void show(int answer) {
        System.out.println(answer);
    }

} Main
import java.util.Scanner;

public class Main {
	public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        Main m = new Main(sc);
        m.show(m.solve());
        sc.close();
    }
    
	//フィールド
    Scanner sc;
    int[] x;
    
    //入力
    Main(Scanner sc) {
        this.sc = sc;
        this.x = new int[5];
    }
    
    //解答処理
    private int solve() {
        int answer = 0;
        for (int i=0; i<5; i++) {
        	x[i] = sc.nextInt();
        	if (x[i] == 0) {
        		answer = i+1;
        	}
        }
        
        return answer;
    }
    
    //出力
    public void show(int answer) {
        System.out.println(answer);
    }

}
