uses crt;

var total:integer;

var i,j,temp,o,input,difference:integer;
var num: array[1..100] of integer;
var data,data2:text;
var icount,icount2,icount3:integer;

begin

o:=0;
input:=0;
input:=0;
assign(data,'data3.txt');
reset(data);
	assign(data2,'out3.txt');
    rewrite(data2);
for icount3:= 1 to 5 do
begin
    read(data,input);
    readln(data);
	for icount2:= 1 to input do
	begin
	   read (data,num[icount2]);
	   readln(data);
	end;
	

	total:=input+1;


	
	clrscr;
	
	for i:=(total-2) downto 1 do 
	begin
		for j:=1 to i do 
		begin
			if (num[j]>num[j+1]) then
			begin
				temp:=num[j];
				num[j]:=num[j+1];
				num[j+1]:=temp;
			end;
		end;
	end;

        if num[1]=2 then
        begin
             o:=1;
        end;
		
        if num[input]=total then
        begin
	        for i:= 1 to total-2 do
	        begin
	           difference:=num[i+1]-num[i];

                   if difference<>1 then
	           begin
                       o:=i+1;
	           end;
	        end;
		
        end
		
		else
		begin
			o:=total;
		end;
		
        if (total=2) and (num[1]=1) then
        begin
             o:=2;
        end;
        if (total=2) and (num[1]=2) then
        begin
             o:=1;
        end;


	for i:= 1 to total-2 do
	begin
	    difference:=num[i+1]-num[i];

            if difference<>1 then
		begin
                        o:=i+1;
		end;
	end;



        write(data2,o);
		writeln(data2);

end;
close(data);
close(data2);
end.
