uses crt;
var i,j,n,max:longint; a,b:array[1..1000000]of longint;
begin
clrscr;
write('Nhap n: ');readln(n);
for i:=1 to n do
begin
write('a[',i,']= ');readln(a[i]);
for j:=1 to i-1 do
if a[i]=a[j] then inc(b[i]);
if b[i]>max then max:=b[i];
end;
for i:=1 to n do if max=b[i] then write(a[i],' ');
readln
end.