import java.util.Scanner; class no481{ public static void main(String[] args) { Scanner stdIn=new Scanner(System.in); int b[]=new int[9],i; for(i=0;i<9;i++) b[i]=stdIn.nextInt(); for(i=0;;i++) if(b[i]!=i+1) break; System.out.print(i+1); } }