Pagini recente » Cod sursa (job #2109015) | Cod sursa (job #1770534) | Cod sursa (job #2036562) | Cod sursa (job #2373432) | Cod sursa (job #1409954)
program elmaj;
var nr,x,n,m,c,i,j:longint;
begin
assign(input,'elmaj.in'); reset(input);
assign(output,'elmaj.out'); rewrite(output);
readln(n);
m:=-1; c:=1;
for i:=1 to n do
begin
read(x);
if x=m then inc(c)
else
begin
dec(c);
if c=0 then
begin
m:=x;
c:=1;
end;
end;
end;
close(input);
reset(input);
readln(n);
nr:=0;
for i:=1 to n do
begin
read(x);
if x=m then inc(nr);
end;
writeln(m,' ',nr);
close(output);
end.