import java.util.Scanner; public class to { public static void main(String[] args){ Scanner input = new Scanner(System.in); String scr = input.nextLine(); String[]num = scr.split(" "); int i = 1; for(i = 1; i<=10; i++){ int a = Integer.parseInt(num[i-1]);//数値に変換 if(i!=a){ System.out.println(a-1); break; }else if(a==9){ System.out.println(a+1); } } } }