program AsmEnvCount;
function EnvCount: Integer; assembler;
asm
mov ah,62h
int 21h
mov es,bx
mov es,es:[2Ch]
xor di,di
xor bx,bx
xor ax,ax
@@1:
mov cx,-1
repne scasb
inc cx
inc cx
jcxz @@2
inc bx
jmp @@1
@@2:
mov ax,bx
end;
begin
Writeln(EnvCount);
end.