function Trail(n: Integer): Integer;
var
Mask: Integer;
begin
T := 0;
while (T < SizeOf(Integer)*8) do
begin
Mask := 1 shl T;
if (n and Mask) <> 0 then Exit;
Inc(T);
end;
end;
begin
writeln(Trail(112),' (should be 4)');
end.
t = bin(n)[::-1].find('1')
b = len(s := format(n, 'b'))
t = b - len(s.rstrip('0'))
function Trail(n: Integer): Integer;
var
Mask: Integer;
begin
T := 0;
while (T < SizeOf(Integer)*8) do
begin
Mask := 1 shl T;
if (n and Mask) <> 0 then Exit;
Inc(T);
end;
end;
begin
writeln(Trail(112),' (should be 4)');
end.