var
t,i,n,p:longint;
begin                                           
assign (input,'WEIGHING.IN'); reset (input);
readln(t);
for i:=1 to t do begin
    readln(n);
    p:=0;
    while n>1 do begin
          if n mod 2=0 then n:=n div 2 else n:=(n div 3)+1;
          p:=p+1;
          end;
    writeln(p);
    end;
end.