Pagini recente » Cod sursa (job #1269496) | Cod sursa (job #2716528) | Cod sursa (job #839660) | Rezultatele filtrării | 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.