program ct;
uses crt;
var P:array[1..1000] of integer;
i,n,M,h:integer;
begin clrscr;
write('Nhap so goi hang: '); readln(n);
for i:=1 to n do
begin
write('Nhap trong luong goi hang thu ',i,': '); readln(P[i]);
end;
write('Nhap trong luong M thoa man: '); readln(M);
h:=0;
for i:=1 to n do
if P[i]<=M then h:=h+1;
writeln('Can ',h,' hop de dong goi ',n,' goi hang tren voi chi phi it nhat');
readln;
end.
Học tốt!