uses crt;
type spis=^uz;
     uz=
     record
      n:integer;
      next:spis;
     end;
var a:spis;
    k:integer;

procedure vvod(a:spis);
var k:integer;
begin
repeat
 read(k);
 if k<>0 then
 begin
  new(a^.next);
  a:=a^.next;
  a^.n:=k;
  a^.next:=nil;
 end;
until k=0;
end;

function check(a:spis):boolean;
var p:spis;
begin
repeat
 p:=a^.next;
 while (p<>nil) and (p^.n<>a^.n) do p:=p^.next;
 a:=a^.next;
until (a=nil) or (p<>nil);
check:=p<>nil;
end;

begin
clrscr;
writeln('vvedite elementi spiska (posledniy = 0):');
a:=nil;
read(k);
if k<>0 then
begin
 new(a);
 a^.n:=k;
 a^.next:=nil;
 vvod(a);
end;
if check(a) then writeln('v spiske est  2 odinakovih elementa')
else writeln('v spiske net odinakovih elementov.');
readkey;
end.{$B+}
