Pagini recente » Cod sursa (job #2579907) | Cod sursa (job #1831989) | Cod sursa (job #2162734) | Cod sursa (job #369611) | Cod sursa (job #964377)
Cod sursa(job #964377)
program elmaj;
var bufin:array[1..100000]of char;
n,i,ans,k,x:longint;
begin
assign(input,'elmaj.in');
reset(input);
settextbuf(input,bufin);
assign(output,'elmaj.out');
rewrite(output);
readln(n);
for i:=1 to n do
begin
read(x);
if ans=0 then
begin
ans:=x;
k:=1;
end else
if ans<>x then
begin
dec(k);
if k=0 then ans:=0;
end
else inc(k);
end;
writeln(ans);
close(output);
end.