program tien_thuong;
uses crt;
var A:array[1..1000] of integer;
n,i,q:integer;
{---Ham-UCLN---}
function ucln(x,y:integer):integer;
begin
while x<>y do
if x>y then x:=x-y else y:=y-x;
ucln:=x;
end;
{---Chuong-trinh-chinh---}
BEGIN
clrscr;
write('Nhap so luong hoc sinh: '); readln(n);
for i:=1 to n do
begin
write('Nhap so cua hoc sinh thu ',i,': '); readln(A[i]);
end;
q:=A[1];
for i:=2 to n do
q:=ucln(q,A[i]);
write('So tien thuong la: ',q);
readln;
end.