program oken;
uses crt;
var a: array [1..10000] of longint;
i,n,tong:longint;
begin
clrscr;
write('nhap so phan tu cua mang: '); readln(n);
tong:=0; i:=1;
while tong<=1000 do
begin
write('a[',i,']: '); readln(a[i]);
tong:=tong+a[i];
i:=i+1;
end;
writeln('Tong lon hon 1000 cua ',i,' phan tu: ',tong);
readln;
end.