program stairs;

{$APPTYPE CONSOLE}

uses
  SysUtils;

var i,j,k,l,m,n:longint;
    r:extended;
begin
  reset(input,'stairs.in');
  read(n);
  for i:=1 to n do
  begin
     read(k);
     r:=((sqrt(1+8*k)-1)/2);
     r:=trunc(r);
     writeln( r:0:0);
  end;
     
end.
