import java.util.Scanner; public class No481 { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int t[] = new int[9]; int i; for(i = 0;i < 9;i++) { t[i] = sc.nextInt(); } for(i = 1;i <= 9;i++) { if(t[i - 1] != i) { break; } } System.out.println(i); } }