program wesi;
Var
i,t,m,k:longint;
Begin
 assign(input,'WEIGHING.in'); reset(input);
 Read(t);
 for i:=1 to t do
  Begin
 Read(m);
 if m=2 then WriteLn('1')
 else
 k:=round((m/2)-1);
 if k=0 then k:=0
 else
  WriteLn('',k);
 end;
end.