PROGRAM pp;
uses wincrt;
type tab=array[*..**] of integer;
var t:tab ; n,i,p,q:integer;
procedure saisie(var n,p,q:integer );
begin
repeat
writeln('donner n ');
readln (n);
until n in [2..20];
writeln('saisie p et q') ;
readln(p,q);
end;
procedure remplir (var t:tab;n:integer);
begin
randomize;
for i:= 1 to n do
begin
t[i]:=10+random(31);
write (t[i],' ');
end;
end;
function existe(x:integer;t:tab;n:integer):boolean;
begin
i:=0;
repeat i:=i+1;
until (t[i]=x)or (i>n);
if i>n then
existe:=false
else
existe:=true;
end;
procedure affichage(t:tab;n:integer);
begin
if (existe(p,t,n)=true) and (existe(q,t,n)=true) then
writeln('2')
else if ((existe(p,t,n)=true) and (existe(q,t,n)=false)) or ((existe(q,t,n)=true) and (existe(p,t,n)=false)) then
writeln('1')
else
writeln('0');
end;
begin
saisie (n,p,q);
remplir(t,n);
writeln;
affichage(t,n);
end.