var N, i2, i3, Dem: int64;
    T, i: longint;

procedure Nhap;
          begin
               readln(N);
          end;

procedure Xuli;
var i: int64;
          begin
               Dem := 1;
               i2 := 2;
               i3 := 2;
               while (i2*i2 <= N) do begin
                     inc(Dem);
                     inc(i2);
               end;
               while(i3*i3*i3 <= N) do begin
                     if trunc(sqrt(i3*i3*i3)) * trunc(sqrt(i3*i3*i3)) <> i3*i3*i3 then inc(Dem);
                     inc(i3);
               end;
               writeln(Dem);
          end;

begin
  readln(T);
  for i := 1 to T do begin
      Nhap;
      Xuli;
  end;
end.

var t:integer;
n,s:longint;
a,b,c:set of integer;
begin
  readln(t);
  for var i:=0 to t-1 do begin
    readln(n);
    s:=0;
    a:=[];
    b:=[];
    c:=[];
    for var j:=1 to n do if j*j<=n then include(a,j*j) else break;
    for var j:=1 to n do if j*j*j<=n then include(b,j*j*j) else break;
    c:=(a-b)+b;
    foreach x: integer in c do s:=s+1;
    writeln(s);
  end;
end.

uses
  Math;

var
  t, step, n, ans: longint;
  i, m: extended;

begin
  read(t);
  for step := 1 to t do begin
    read(n);
    i := 1;
    ans := 0;
    m := floor(sqrt(n));
    while i <= m do begin
      inc(ans, 2);
      if (i * i * i > n) or (frac(sqrt(i * i * i)) = 0) then
        dec(ans);
      i := i + 1;
    end;
    writeln(ans);
  end;
end.

{$Ifdef Home}
unit Task_B;
interface
implementation
{$Else}
program Task_;
{$EndIf}

{$APPTYPE CONSOLE}
{$T+}

//todo -c adsads -oPPP: asdsada

uses
  SysUtils,
  Types,
  Math,
  Classes;

const
{$Ifdef Home}
  Home=true;
{$Else}
  Home=false;
{$EndIf}

var
  GCD_PassCnt: int64=0;

  Test: boolean=false;
  Check: boolean=false;
  Hack: boolean=false;
  Echo: boolean=false;
  Data: array of string;
  TestFile: textFile;

procedure Stop;
begin

end;

procedure SetData(S: array of string);
  var
    i: integer;
  begin
  SetLength(Data, Length(S));
  for i:=0 to High(S) do
    Data[i]:=S[i];
  end;

procedure Swap(var A, B: int64); overload;
  var
    C: int64;
  begin
  C:=A;
  A:=B;
  B:=C;
  end;

procedure FillStrRnd(var S: string; C: array of char);
  var
    n: integer;
    i: integer;
  begin
  N:=Length(C);
  for i:=1 to Length(S) do
    S[i]:=C[random(N)];

  end;  // FillStrRnd

//==============================================================================

procedure FillRnd(A: TInt64DynArray; Min, Max: int64);
  var
    i: integer;
  begin
  for i:=0 to High(A) do
    A[i]:=Min+random(Max-Min+1);

  end;  // FillStrRnd

//==============================================================================

procedure ReadPrepare(FileName: string);
  begin
  if not FileExists(FileName) then
    begin
    WriteLn(format('TestFile "%s" not found', [FileName]));
    WriteLn('Press <ENTER> to terminate');
    System.ReadLn;
    halt(1);
    end;

  AssignFile(TestFile, FileName);
  Reset(TestFile);
  end;

procedure Read_(var X: int64); overload;
  begin
  if Test then System.Read(TestFile, X)
  else         System.Read(X);
  end;

procedure Read_(var X: double); overload;
  begin
  if Test then System.Read(TestFile, X)
  else         System.Read(X);
  end;

procedure Read_Ln(var X: int64); overload;
  begin
  if Test then System.ReadLn(TestFile, X)
  else         System.ReadLn(X);
  end;

procedure Read_Ln(var X: double); overload;
  begin
  if Test then System.ReadLn(TestFile, X)
  else         System.ReadLn(X);
  end;

procedure Read_Ln(var Str: string); overload;
  begin
  if Test then System.Readln(TestFile, Str)
  else         System.Readln(Str);
  end;

//------------------------------------------------------------------------------

// ������ � Delphi. �����: A, B: int64;
//   1) ������ ���� ������� ��������� (var X: array of int64) � �������� ([A, B])
//
//   2) ���� � �������������� �����������
//        ���� ������� (X: array of pInteger) � (X: array of pInt64), ��
//        ���������� ��������������� ��� ������ ([@A, @B])
//   3) ���� ���� ������ ReadLn(X: array of pInt64),
//        �� ��� ������ ReadLn([@A, @B]) ������ Ordinal type req...
//        ������ ����������� �� ����������� ��������
//        ������� ������� ����� ��� ������� �������� ���� Task_C.

procedure Read_Ln(X: array of pInt64); overload;
  var
    i, h: integer;
  begin
  h:=High(X);
  for i:=0 to h-1 do
    Read_(X[i]^);

  Read_Ln(X[h]^)
  end;

//------------------------------------------------------------------------------

procedure Read_LnD(X: array of pdouble); overload;
  var
    i, h: integer;
  begin
  h:=High(X);
  for i:=0 to h-1 do
    Read_(X[i]^);

  Read_Ln(X[h]^)
  end;

//------------------------------------------------------------------------------

procedure Read_Ln(X: TInt64DynArray); overload;
  var
    i, h: integer;
  begin
  h:=High(X);
  for i:=0 to h-1 do
    Read_(X[i]);

  Read_Ln(X[h])
  end;

procedure Write_Ln(X: TInt64DynArray);
  var
    i: integer;
  begin
  if Length(X)=0 then
    WriteLn('')
  else
    begin
    for i:=0 to High(X)-1 do
      Write(X[i], ' ');
    WriteLn(X[High(X)]);
    end;

  end;

type

  TInt64Array=array [0..$7FFFFFF] of int64;
  PInt64Array=^TInt64Array;

  TIteratorAxisCustom=class
//    Common: TIntegerDynArray;
  //  ExtraA, ExtraB, ExtraB: TIntegerDynArray;

    AxisCnt: integer;
    AxisIdx: integer;
    AxisVal: TIntegerDynArray;

    function StateStr: string; virtual;
    function NextAxisVal: boolean; virtual; abstract;
    function Next: boolean; virtual;
    procedure UpdateAxisVal(Axis, ValNew: integer); virtual;
    procedure Init(AxisCnt: integer); virtual;
    procedure AddAxis(AxisVal: integer);
    procedure Reset; virtual;
    end;
//------------------------------------------------------------------------------

  TIteratorAxis=class(TIteratorAxisCustom)
    AxisValHi: TIntegerDynArray;

    function  NextAxisVal: boolean; override;
    procedure AddAxisHi(AxisVal, AxisValHi: integer);
    end;

//==============================================================================
// {$T+} Usage:
//    A: TInt64DynArray;
// QuickIntSort_(pInt64Array(@A[0]), nil, 0, n-1);

procedure QuickSort(Value, Order: PInt64Array; iLo, iHi: Integer; OrderSign: integer=0);
  var
    Lo, Hi: Int64;
    MidVal, MidOrd: int64;
    Tmp: int64;
    UseOrder: boolean;
  begin
  Lo:=iLo;
  Hi:=iHi;
  if Hi<Lo then Exit;
  UseOrder:=(OrderSign<>0) and Assigned(Order);
  if UseOrder then
    OrderSign:=OrderSign div abs(OrderSign)
  else
    OrderSign:=0;

  MidVal:=Value[(Lo + Hi) div 2];
  if UseOrder then
    MidOrd:=OrderSign*Order[(Lo + Hi) div 2]
  else
    MidOrd:=0;
  repeat
    //while Value[Lo]<Mid do Inc(Lo);
    //while Value[Hi]>Mid do Dec(Hi);
    {while (Value[Lo]<MidVal) or (UseOrder and (Value[Lo]=MidVal) and (OrderSign*Order[Lo]<MidOrd)) do
      Inc(Lo);
    while (Value[Hi]>MidVal) or (UseOrder and (Value[Hi]=MidVal) and (OrderSign*Order[Hi]>MidOrd)) do
      Dec(Hi);{}

    if UseOrder then
      begin
      while (Value[Lo]<MidVal) or
           ((Value[Lo]=MidVal) and (OrderSign*Order[Lo]<MidOrd)) do
        Inc(Lo);
      while (Value[Hi]>MidVal) or
           ((Value[Hi]=MidVal) and (OrderSign*Order[Hi]>MidOrd)) do
        Dec(Hi);
      end
    else
      begin
      while Value[Lo]<MidVal do Inc(Lo);
      while Value[Hi]>MidVal do Dec(Hi);
      end;

    if Lo<=Hi then
      begin
      Tmp:=Value[Lo];
      Value[Lo]:=Value[Hi];
      Value[Hi]:=Tmp;

      if Assigned(Order) then
        begin
        Tmp:=Order[Lo];
        Order[Lo]:=Order[Hi];
        Order[Hi]:=Tmp;
        end;

      Inc(Lo);
      Dec(Hi);
      end;
  until Lo > Hi;
  if Hi>iLo then QuickSort(Value, Order, iLo, Hi, OrderSign);
  if Lo<iHi then QuickSort(Value, Order, Lo, iHi, OrderSign);
  end;  // QuickIntSort

type
  TCmpInt64=function(A, B: int64): int64;

var
  Cmp_PC: int64=0;

procedure QuickSortCmp(Value0, Order0: PInt64; Cmp: TCmpInt64; iLo, iHi: Integer); overload;
  var
    Lo, Hi: Int64;  // indexes
    Mid, Tmp: int64;  // values
    Value, Order: pInt64array;
  begin
  Value:=pInt64array(Value0);
  Order:=pInt64array(Order0);

  Lo:=iLo;
  Hi:=iHi;
  if Hi<Lo then Exit;
  Mid:=Value[(Lo + Hi) div 2];
  repeat
    //while Value[Lo]<Mid do Inc(Lo);
    while (Cmp(Value[Lo], Mid)<0) do
      begin
      if test then
        inc(Cmp_PC);

      Inc(Lo);
      end;

    while (Cmp(Value[Hi], Mid)>0) do
      begin
      if test then
        inc(Cmp_PC);

      Dec(Hi);
      end;

    if Lo<=Hi then
      begin
      Tmp:=Value[Lo];
      Value[Lo]:=Value[Hi];
      Value[Hi]:=Tmp;

      if Assigned(Order) then
        begin
        Tmp:=Order[Lo];
        Order[Lo]:=Order[Hi];
        Order[Hi]:=Tmp;
        end;

      Inc(Lo);
      Dec(Hi);
      end;
  until Lo > Hi;

  if Hi>iLo then QuickSortCmp(Value0, Order0, Cmp, iLo, Hi);
  if Lo<iHi then QuickSortCmp(Value0, Order0, Cmp, Lo, iHi);
  end;  // QuickSortCmp

//------------------------------------------------------------------------------

var
  TEST_Val: TInt64DynArray;

function TEST_Cmp(A, B: int64): int64;
  begin
  Result:=A-B;
  end;

procedure TEST_QuickSortCmpInt64;
  var
    N: integer;
    M: integer;
    i, j: integer;
    C: int64;
    ErrCnt: integer;
    PassCnt: integer;
  begin
  M:=100;
  PassCnt:=0;
  ErrCnt:=0;
  for N:=1 to 60 do
    begin
    SetLength(TEST_Val, N);
    for j:=0 to M-1 do
      begin
      inc(PassCnt);
      if PassCnt=304 then
        Stop;

      for i:=0 to N-1 do
        TEST_Val[i]:=random(1+2*N);

      QuickSortCmp(@TEST_Val[0], nil, TEST_Cmp, 0, N-1);

      for i:=1 to N-1 do
        begin
        C:=TEST_Cmp(TEST_Val[i-1], TEST_Val[i]);
        if C>0 then
          begin
          WriteLn('Sort error on pass: ', PassCnt);
          inc(ErrCnt);
          end;
        end;
      end;
    end;

  if ErrCnt=0 then
    WriteLn('Sort Test passed')
  else
    WriteLn('Sort Test failed');
  end;  // TEST_QuickSortCmpInt64

//==============================================================================

procedure TIteratorAxisCustom.AddAxis(AxisVal: integer);
  begin
  SetLength(Self.AxisVal, AxisCnt+1);

  inc(AxisCnt);
  UpdateAxisVal(AxisCnt-1, AxisVal);

  end;  // AddAxis

//==============================================================================

procedure TIteratorAxis.AddAxisHi(AxisVal, AxisValHi: integer);
  begin
  SetLength(Self.AxisValHi, AxisCnt+1);

  Self.AxisValHi[AxisCnt]:=AxisValHi;

  AddAxis(AxisVal);
  end;  // AddAxis

//==============================================================================

procedure TIteratorAxisCustom.Init(AxisCnt: integer);
  var
    a: integer;
  begin
  Self.AxisCnt:=AxisCnt;
  AxisIdx:=0;
  SetLength(AxisVal, AxisCnt);
  for a:=0 to AxisCnt-1 do
    begin
    AxisVal[a]:=0;
    end;
  end;  // Init

//==============================================================================

function TIteratorAxis.NextAxisVal: boolean;
  begin
  Result:=AxisVal[AxisIdx]<AxisValHi[AxisIdx];
  end;  // NextAxisVal

//==============================================================================

function TIteratorAxisCustom.Next: boolean;
  var
    AxisIdx0, a: integer;
  begin
  AxisIdx0:=AxisIdx;
  Result:=false;
  repeat
    Result:=NextAxisVal;
    if Result then
      begin
      //inc(AxisVal[AxisIdx]);
      UpdateAxisVal(AxisIdx, AxisVal[AxisIdx]+1);
      if AxisIdx<>AxisIdx0 then
        begin
        //for a:=0 to AxisIdx-1 do
        //  UpdateAxisVal(a, 0);
        AxisIdx:=0;
        end;
      end
    else
      begin
//      PrevAxisVal;
      if AxisIdx<AxisCnt-1 then
        begin
        for a:=0 to AxisIdx do
          UpdateAxisVal(a, 0);
        inc(AxisIdx)
        end
      else
        Break;
      end;

    until Result;

  end;  // Next       {}

//==============================================================================

procedure TIteratorAxisCustom.Reset;
  var
    a: integer;
  begin
  for a:=0 to AxisCnt-1 do
    UpdateAxisVal(a, 0);
  AxisIdx:=0;
  end;

function TIteratorAxisCustom.StateStr: string;
  var
    a: integer;
  begin
  Result:='';
  for a:=AxisCnt-1 downto 0 do
    Result:=Result + format('%d', [AxisVal[a]]);
  end;

//==============================================================================

procedure TIteratorAxisCustom.UpdateAxisVal(Axis, ValNew: integer);
  begin
  AxisVal[Axis]:=ValNew;
  end;

//==============================================================================

function gcd(x, y: int64): int64;
  begin
  if y<>0 then
    Result:=gcd(y, x mod y)
  else
    Result:=x;
  end;  // gcd

//------------------------------------------------------------------------------

function LCM(x, y: int64): int64;
  begin
  Result:=(x div gcd(x, y))*y;
  end;

//------------------------------------------------------------------------------

// Greatest Common Divider
function GCDold(a, b: int64): int64;
  var
    t: int64;
    a_, b_: int64;
  begin
  inc(GCD_PassCnt);
  if GCD_PassCnt=4362 then
    Stop;

  a_:=abs(a);
  b_:=abs(b);

  while (b_<>0) do
    begin
    t:=b_;
    b_:=a_ mod b_;
    a_:=t;
    end;
  result:=a_;
  end;  // GCD

//------------------------------------------------------------------------------

procedure TestGCD;
  var
    x, y: int64;
    xy, xyold: int64;
    ErrCnt: int64;
  begin
  ErrCnt:=0;
  repeat
    x:=random(1000);
    y:=random(1000);

    xy:=gcd(x, y);
    xyold:=gcdold(x, y);

    if xy<>xyOld then
      begin
      inc(ErrCnt);
      Stop;
      end;
    until false;
  end;  // TestGCD

//==============================================================================
var
  PrimeList: TIntegerDynArray;

function PrimeCntList(X: int64): integer;
  var
    p, Cnt, i: integer;
    Y: int64;
  begin
  Result:=0;
  if X<=1 then
    Exit;

  Cnt:=Length(PrimeList);
  Y:=X;
  for i:=0 to Cnt-1 do
    begin
    p:=PrimeList[i];
    if p=0 then
      Stop;
    while Y mod p=0 do
      begin
      Y:=Y div p;
      inc(Result);
      end;

    if sqr(p)>Y then
      Break;
    end;

  if Y>1 then
    inc(Result);
  end;

//------------------------------------------------------------------------------

function PrimeCnt(X: int64): integer;
  var
    p, y: integer;
    pp: int64;
  begin
  Result:=0;
  if X<=1 then
    Exit;

  y:=x;
  p:=2;
  while (y mod p)=0 do
    begin
    y:=y div p;
    inc(Result);
    end;

  inc(p);

  while (sqr(p)<=y) do
    begin
    while y mod p=0 do
      begin
      y:=y div p;
      inc(Result);
      end;
    inc(p, 2);
    end;{}

  if y>1 then
    inc(Result);
  end;  // PrimeCnt

//==============================================================================

procedure PrimeCntPrepare(Xmax: int64);
  var
    h: int64;
    p: integer;
    Y: int64;
    Count, Capacity: integer;

  procedure Add(p: integer);
    begin
    if Count=Capacity then
      begin
      Capacity:=Max(2*Capacity, 4);
      SetLength(PrimeList, Capacity);
      end;

    PrimeList[Count]:=p;
    inc(Count);
    end;

  begin
//  Result
  h:=round(sqrt(1.0*Xmax));
  while (h*h)<Xmax do
    inc(h);

  Count:=0;
  Capacity:=0;
  SetLength(PrimeList, Capacity);
  Add(2);
  Add(3);

  p:=5;
  while ((int64(p)*p)<=Xmax) do
    begin
    if PrimeCntList(p)=1 then
      Add(p);

    inc(p, 2);
    end;{}
  end;  // PrimeCntPrepare

//==============================================================================

type
  TValTree=class
    Sgn: integer;
    LevelH: integer;
    OpCnt: int64;
    OpCntTot: int64;
    LevelVal: array of TInt64DynArray;
    //LevelData: array of array of TTreeNodeData;
    function  Value(Idx: integer): int64;
    procedure NodeOp(Level, NodeIdx: integer; var Res: int64);
    procedure LevelRange(Level: integer; L, R: integer; var Res: int64);
    function  Range(L, R: integer): int64;
    procedure Init(Src: TInt64Dynarray);

    //procedure OpMinMax(Level, NodeIdx: integer);
    end;

  function TValTree.Value(Idx: integer): int64;
    begin
    Result:=LevelVal[LevelH][Idx];
    end;

  procedure TValTree.NodeOp(Level, NodeIdx: integer; var Res: int64);
    begin
    if Sgn>0 then Res:=max(Res, LevelVal[Level, NodeIdx])
    else          Res:=min(Res, LevelVal[Level, NodeIdx]);
    end;

  procedure TValTree.LevelRange(Level: integer; L, R: integer; var Res: int64);
    var
      Step, i: integer;
      L_, R_: integer;
      Val: int64;
      NodeL, NodeR: integer;
      NodeL_, NodeR_: integer;
      Prefix: string;
    begin
    inc(OpCnt);
    Step:=1 shl (LevelH-Level);

    if Echo then
      begin
      Prefix:=StringOfChar(' ', 3*Level);
      WriteLn(format('%s  %2d %2d   %2d %2d', [Prefix, Level, Step, L, R]));
      if Level>=4 then
        Stop;
      end;

    if Step=1 then
      begin
      for i:=L to R do
        begin
        NodeOp(Level, i, Res);
        if Echo then
          WriteLn(Prefix, '+');
        end;
      end
    else
      begin
      NodeL:=(L) div Step;
      NodeR:=(R) div Step;
      L_:=NodeL*Step;
      R_:=(NodeR+1)*Step-1;
      if NodeL=NodeR then
        begin
        if (L=L_) and (R=R_) then
          begin
          inc(OpCnt);
          NodeOp(Level, NodeL, Res);
          if Echo then
            WriteLn(Prefix, '+', Step);
          end
        else
          LevelRange(Level+1, L, R, Res)
        end
      else
        begin
        NodeL_:=NodeL;
        NodeR_:=NodeR;
        if L<>L_ then
          begin
          LevelRange(Level+1, L, (L_+Step-1), Res);
          inc(NodeL_);
          end;

        if R<>R_ then
          begin
          LevelRange(Level+1, (R_-Step+1), R, Res);
          dec(NodeR_);
          end;

        for i:=NodeL_ to NodeR_ do
          begin
          NodeOp(Level, i, Res);
          inc(OpCnt);
          if Echo then
            WriteLn(Prefix, '+', Step);
          end;
        end;
      end;

    end;

  function TValTree.Range(L, R: integer): int64;
    var
      i: integer;
      Res: int64;
    begin
    OpCnt:=0;
    Result:=Value(L);
    LevelRange(0, L, R, Result);

    if false then
      if Test then
        begin
        Res:=Value(L);
        for i:=L to R do
          if Sgn*Value(i)>Sgn*Res then
            Res:=Value(i);
        if Result<>Res then
          Writeln('ERROR');
        end;

    inc(OpCntTot, OpCnt);
    end;

procedure TValTree.Init(Src: TInt64Dynarray);
  var
    Count, Count2: integer;
    IdxH, j, i: integer;
  begin
  Count2:=1;
  LevelH:=0;
  Count:=Length(Src);
  while Count2<Count do
    begin
    inc(LevelH);
    Count2:=Count2*2;
    end;

  SetLength(LevelVal, LevelH+1);

  for i:=0 to LevelH do
    SetLength(LevelVal[i], (1 shl i));

  for i:=0 to Count-1 do
    LevelVal[LevelH][i]:=Src[i];

  for i:=Count to Count2-1 do
    LevelVal[LevelH][i]:=Src[Count-1];

  for j:=LevelH-1 downto 0 do
    begin
    Count2:=Count2 div 2;
    for i:=0 to Count2-1 do
      begin
      LevelVal[j][i]:=LevelVal[j+1][2*i];
      LevelRange(j+1, (i shl (LevelH-j)), ((i+1) shl (LevelH-j)-1), LevelVal[j][i]);
      end;
    end;
  end;  // Init

//==============================================================================
// 1, 3, 2  ->  1*3 + 2*3 + 1*2
// ����� ��������v� ��

function PairCombCount(List: TInt64DynArray; Count: integer): int64;
  var
    i: integer;
    S, C: int64;
  begin
  Result:=0;
  if Count>=2 then
    begin
    S:=List[0];

    for i:=1 to Count-1 do
      begin
      C:=S*List[i];
      S:=S+List[i];

      inc(Result, C);
      end;{}
    end;
  end;

//==============================================================================

function CombCount(N, K: integer): int64;
  var
    i: integer;
    S, C: int64;
    Nom, Den: int64;
  begin
  // N!/(k! * (N-K)!
  Result:=1;
  if N>1 then
    begin

    Nom:=1;
    Den:=1;
    for i:=1 to K do
      begin
      Nom:=Nom*(N+1-i);
      Den:=Den*i;
      end;
    Result:=Nom div Den;
    end;
  end;

//==============================================================================
// CombCount
(*function deg(i64 x, i64 d): int
  begin
    d %= P - 1;
    if (d < 0) d += P - 1;
    i64 y = 1;
    while (d) {
        if (d & 1) (y *= x) %= P;
        d /= 2;
        (x *= x) %= P;
    }
    return y;
}

i64 cnk(int n, int k) {
    if (k < 0 || k > n) return 0;
    i64 num = 1, den = 1;
    forn(i, k) {
        (num *= n - i) %= P;
        (den *= i + 1) %= P;
    }
    return num * deg(den, -1) % P;
}
*)

//==============================================================================

function GetIdxSortedDir(A: TInt64DynArray; AVal: int64; Dir: integer;
            var Idx0_, Idx1_: integer): integer;
  var
//    Idx0, Idx1: integer;
    N: integer;

    L, M, R: integer;
    Pass: integer;
  begin
  N:=Length(A);

  L:=-1;
  R:=N;
  Pass:=0;

  repeat
    M:=(L+R+Pass) div 2;

    Pass:=1-Pass;
    if A[M]<AVal then
      L:=M;

    if Dir<0 then
      begin //   AVal
            //
      if A[M]<AVal then
        L:=M;

      if A[M]>=AVal then
        R:=M;
      end;

    if Dir>0 then
      begin //   AVal
            //
      if A[M]>AVal then
        R:=M;

      if A[M]<=AVal then
        L:=M;
      end;

    until (R-L<=1);
  Idx0_:=L;
  Idx1_:=R;
  end;

function GetIdxSorted(A: TInt64DynArray; AVal: int64; var Idx0, Idx1: integer): integer;
  var
    IdxL0, IdxL1: integer;
    IdxR0, IdxR1: integer;
  begin
  GetIdxSortedDir(A, AVal, -1, IdxL0, IdxL1);
  GetIdxSortedDir(A, AVal, +1, IdxR0, IdxR1);

  Idx0:=IdxL0;
  Idx1:=IdxR1;
  end;

// GetIdxSorted(A, 4, Idx0, Idx1);
//------------------------------------------------------------------------------

//==============================================================================

function Fact(N: integer): int64;
  var
    i: integer;
  begin
  Result:=1;
  for i:=2 to N do
    Result:=Result*i;
  end;

//==============================================================================

const
  ConstMod=1000000007;
var
  FullTest: boolean;

  PassCnt: int64=0;
  Suffix: string;
  OpCnt: int64=0;

type
  TRes=int64;

const
  ResDefault: TRes=0;

type
  TDomArray=array [0..1] of int64;

  TTask=object  // todo: #0 TTask
    Pass: integer;
    Sim: boolean;
    N: int64;

//    X0, X1: TInt64DynArray;
    //Order: TInt64DynArray;
    //S: string;

    procedure Gen;
    procedure GenHack;
    procedure Read;
    procedure Prepare;
    function SolveSmart: TRes;
    function SolveDumb: TRes;
    function Solve: TRes;
    end;

var
  Task: TTask;

//==============================================================================

procedure SubTask(ti: integer); forward;

procedure Main;
  var
    i: integer;
    t: int64;

  begin  // todo -c: #1 Main
  Task.Pass:=0;
//  SubTask(-1);  exit;
//------------------------------------------------------------------------------

  i:=-1;
  Read_Ln(t);

  Task.Prepare;

  for i:=0 to t-1 do
    begin
    Task.Pass:=i;
    SubTask(i);
    end;

  if Test then
    Stop;
  end;  // Main

//------------------------------------------------------------------------------

procedure TTask.Prepare;
  const
    Sample: array [0..5] of string=
            ('abc', 'acb', 'bac', 'cab', 'bca', 'cba');
  var
    i, j: integer;

  begin  // todo -c: #2 Prepare

  Stop;
  end;  // Prepare

//------------------------------------------------------------------------------

procedure TTask.Read;
  var
    i, j: integer;
    S_: string;
  begin  // todo -c: #3 Read
  Sim:=false;
//  Sim:=true and Test;

  if not Sim then
    begin
    Read_Ln([@N]);
    //Read_Ln([@N, @K, @X]);
//    Read_Ln([@K]);
//    Read_Ln(S);

  {  for i:=0 to 3 do
      begin
      Read_(K[i]);
      SetLength(XY[i], K[i]);
      Read_Ln(XY[i]);
      end;{}

  { for i:=0 to N-1 do
      begin
//      Read_Ln(S[i]);

      //Read_Ln([@X[i], @Y[i]]);
      end;{}
    end
  else
    begin
    randomize;
    randseed:=57967349;
    //N:=2*100*1000;
    WriteLn(Randseed);
//    N:=20;
//    Q:=30;
//    Q:=2*1000;
    //Q:=100*1000;
    //SetLength(A, N);
    //SetLength(B, N);
    {for i:=0 to N-1 do
      begin
      //A[i]:=random(5);
      //B[i]:=random(5);
      end;{}

    end;

//  SetLength(K, N);
//  SetLength(A, N);

{  for i:=0 to N-1 do
    begin
    Read_(K[i]);

    SetLength(A[i], K[i]);

//    Read_Ln([@L[i], @R[i]]);
    Read_Ln(A[i]);
    end;{}

//  Read_Ln(A);
  end;  // Read

//------------------------------------------------------------------------------

procedure TTask.GenHack;
  begin
//  N:=200*1000;
//  N:=1000;
//  SetLength(A, N);

  if Hack then
    begin
    WriteLn(1);
//    WriteLn(N);
    end;

  if Hack then
    Stop;
  end;

procedure TTask.Gen;
  var
    Hi: int64;
    i: integer;
  begin
  GenHack;
  Exit;

  OpCnt:=0;
  Hi:=200*1000;
//  Hi:=4;
//  N:=2+random(Hi);
//  SetLength(A, N);

  if Hack then
    begin
    WriteLn(1);
//    WriteLn(N);
    end;
//  for i:=0 to N-1 do
    begin
//    A[i]:=1+random(min(1000*1000*1000, hi*hi div 2));
    if Hack then
//      if i<N-1 then Write(A[i], ' ')
  //    else          WriteLn(A[i]);
    end;

  if Hack then
    Stop;
  end;  // Gen

//==============================================================================
type
  TTreeNodeData=object
    ValMin, ValMax: int64;
//    procedure Op; override;
    end;

{  TTreeNodeMinMaxRes=class(TTreeNode)
    ValMin, ValMax: int64;
    procedure Op; override;
    end;}

//------------------------------------------------------------------------------
procedure Swap3(var A, B, C: int64);
  var
    D: integer;
  begin
  D:=A;
  A:=B;
  B:=C;
  C:=D;
  end;

(*  SetLength(S, N);
  SetLength(Where, N);
  SetLength(ToBe, N);

  for i:=0 to N-1 do
    begin
    S[i]:=A[i];
    Where[i]:=i;
    end;

  QuickSort(PInt64Array(@S[0]), PInt64Array(@Where[0]),  0, N-1,   0);

  Same:=0;
  for i:=0 to N-1 do
    begin
    ToBe[Where[i]]:=i;
    end;

    Swap3(A[i], A[j], A[k]);
    Swap3(ToBe[i], ToBe[j], ToBe[k]);

    Where[ToBe[i]]:=i;
    Where[ToBe[j]]:=j;
    Where[ToBe[k]]:=k;{}

    //for i:=0 to N-1 do  // ���� � �������
      //Where[ToBe[i]]:=i;

    if test_ then
      for i:=0 to N-1 do
        if ToBe[Where[i]]<>i then
          Stop;
    end;
    *)

function TTask.SolveDumb: TRes;
  var
    i, j: integer;
//    N: integer;
    i2, i3: int64;
    i2_: int64;
  begin  // todo -c: #5 SolveDumb
//  inc(PassCnt);
  Result:=ResDefault;
  if PassCnt=5 then
    Stop;

  i:=1;
  repeat
    i2:=sqr(i);
    i3:=i2*i;
    if i2<=N then
      inc(result)
    else
      break;

    if i3<=N then
      begin
      i2_:=round(sqrt(1.*i3));
      if sqr(i2_)<>i3 then
        inc(result);
      end;
    inc(i);
    until false;

{  if Result=0 then
    WriteLn('YES')
  else
    WriteLn('NO');{}
//    QuickSort(PInt64Array(@XY[i][0]), PInt64Array(nil),  0, K[i]-1,   0);

//  SetLength(C, N);

  WriteLn(Result);

  Stop;
  end;  // SolveDumb

//==============================================================================

function TTask.SolveSmart: TRes;
  var
    i: integer;
  begin  // todo -c: SolveSmart
  Result:=ResDefault;
  Stop;
  end;  // SolveSmart

//==============================================================================

function TTask.Solve: TRes;
  var
    ResSmart, ResDumb: TRes;
    i, j: integer;
  begin  // todo -c: Solve
  OpCnt:=0;

//  Mod_:=31607;

//  Result:=0;
  ResSmart:=ResDefault;
  ResDumb:=ResDefault;

//  ResSmart:=SolveSmart;
  ResDumb:=SolveDumb;

  if Check then
    begin
    ResDumb:=SolveDumb;
    if ResSmart<>ResDumb then
      begin
      WriteLn(format('Error  %9d <> %9d', [ResSmart, ResDumb]));
      Stop;
      end;
    end;

//  Result:=ResSmart;
  Result:=ResDumb;
  end;  // Solve

//==============================================================================

procedure SubTask(ti: integer);
  var
    Res: TRes;
    itr: integer;
    i: integer;
    Pass: integer;
    time0, time1, WorkTime: double;
    RandSeed0: integer;

  begin
  inc(PassCnt);

  if Test then
    if FullTest then
      begin
      Pass:=0;
      repeat
        inc(Pass);
        RandSeed0:=RandSeed;
        Write(format('Pass: %8d  RS $%0.8x', [Pass, RandSeed0]));
        WriteLn('');

        Task.Gen;

        time0:=now;

{        for Itr:=1 to 1 do
          Res:=Task.Solve;{}
        for Itr:=0 to 20 do
          begin
          //Task.N:=int64(1000)*1000*1000*1000*1000*10+Itr;
//          Task.N:=Itr;
          Res:=Task.Solve;
//          WriteLn(format('%5d  %5d', [Task.N, Res]));
          end;

        time1:=now;
        WorkTime:=SecsPerDay*(time1-time0);
//        if WorkTime>0.1 then
          WriteLn(format('  Res: %9d  OP: %8d  Time: %5.2f',
                          [Res, OpCnt, WorkTime]));

        Stop;

        until false;{}
      end;

  Task.Read;

  Res:=Task.Solve;

  if Test then Suffix:=format('   %d', [OpCnt])
  else         Suffix:='';
  // todo -c: #8 SubTask

//  WriteLn(format('%d', [Res]));//, Suffix)
//  WriteLn(Res);
//  WriteLn(Length(IntToStr(Res)));
//  WriteLn(Res);
{  if (Res+1)<=Task.k then
    WriteLn('Yes')
  else
    WriteLn('No');{}

  end;  // SubTask

//------------------------------------------------------------------------------

begin
randseed:=126;
//randseed:=$3B8B1C67;

Test:=Home;  // ================
//Check:=Home;
//FullTest:=Test;
//Hack:=true;
//Echo:=Home;

if Hack then
  begin
  Task.GenHack;

  //Task.Gen;
  Stop;
  exit;
  end;

if Test then
  begin
  ReadPrepare('Task_B_0.txt');
  end;

Main;

if Test then
  ReadLn;

end.

       const eps=1e-10;
       besk=4000000000000000000; label 33,55,5,4,1,3,2,44,22;
       type
       mas=array[-500000..1570460+1] of int64;
       integer=longint;   zap=record  p1,p2,p3:int64; end;
       zap1=^zap;
       var  kol,kolzikl,start,px,py,posx,posy,cur,init,res,oldpos,i1,j1,mask,stepp,n2,i,j,k,l,step,k1,mesto:longint;
       sss:array[-1..1000000] of string;
       ch1,ch2:char;
       ssans,ss1,ss4,oldss,smin,ss3,ss,ss2:string;
       newaans,aans:zap;
       otr1,otr0,d0,vx,vy,ddist,tttt:extended;
       pqqq:zap;
       gam,al0,otal,al1,al2,acc, disk,prop,bet,al:extended; fl1,fl2,fl:boolean;
       dr3,dr1,dr2,pt,ott1,ott2:zap;

       i3,p,tt,sum,pp1,pp2,root,oldans,par,dlkruga,topt,t1,t2,t3,ot,aa,bb,cc,dist,znak,rr,kolmax,kkol,pos,pq,razm,poss,mm,tip,ppos1,oldtt,ps,pos1,pos2,pred,color,buk:int64;
       time,zz,x:array[-1000..1110000] of int64;
       stroka,sss1,sss2:array[-10..610000] of string;
       v3,v1,v2,pointx,pointy,vel,tt0,radius,ote,dl1,dl2:extended;
       ddl,dnewr,dnewl,dr,ddpos:array[-10..210,-20..150,0..9] of int64;
       xold,yold,xxold,yyold,xmin,xmax,ymin,ymax,xx,str,zx,zy,z,xxx,yyy,invfact,y,ansx,ansy,ugol,yy:array[-1000000..2110000] of int64;
       ll,ost,shag,napr,dl,ppos,ii,jj,t,ptek,dloch1,oldaa,oldbb,zapas,ott,mnog,ttt,delta,tt1,tt2,koll,newt,osn,oldot,num,oldt,znmax,t11,t01,t10,t00,opld,nap,t4,iii,jjj,aaa,bbb,ccc,p0,newpos,newdl,len,pp3,ans1,ans2,modul,t0,dloch,koldel,mmax,period, dolg,ot1,ot2,oldgr,predsum,pmin,tmin,kool,number,imin,qq,n,m,numpos,down,imax,qq1,qq2,q1,q2,w,p3,p4,pmax,pmax2,p1,p2,pos0,pp,maxot,tmax,nn,n1,q:int64; flag1:boolean;
       olda,b,c,a,zzz,fact,stan,a2,invx,invy,place,b2,sum1,sum0,d:mas; flag2,flag:boolean;  pl:longint;
       dx,dy,gor,ver,i2,j2,ans,sdvig,izb, oldmax,newmax,posmax,razn,ppp,minx,miny,maxx,maxy,jmax,gr,grr,ener,dob,ugg,r,ug:int64;
        polezan:array[-1..1000,-1..1000] of boolean;
       zan1,zan2,prost,zan:array[-1000..2001001] of boolean;
       newzan,zann:array[-1000000..4000000] of boolean;
       zanx,marked:array[-1000000..4100000] of boolean;
       zikl,dlzikl,sumdl,z1,z2,x1,y1,x2,y2,ddnew,d3,d1,right,dmin,dd1,left,dnomer:array[-1111..1100000] of int64;
       nomer,ochh,newochh:array[-1000..4000000] of longint;
       newx,newy,dplus,dminus,och1,b1,a1,first,last,kolnenul,next1,next0,prev1,prev0,newoch,och,lx,a3,b3,predok:array[-20000..1610000] of int64;
       ddsum,ddd:array[-400..565200,-1..10] of int64;
        pole,newpole:array[-100..600,-100..600] of char;
       ddold,dd,polessum:array[-100..1300,-100..1300] of int64;

       ssan,bufer:array[-1000..1000000] of char;
       cosa,sina,cosb,sinb,rx,ry,h1,h2,h,l1,l2,otmax,v:int64;
       obmen,ch:char;
       stepen,mat:array[-10..1050001,0..4] of longint;
       flagg,fflag,ok,flagg1:boolean;
       koled,oldx,oldy,numx,numy,xleft,xright,s,newplace,newstr,next,prev,aold:array[-1000..1200002] of int64;

       function srav(i,j:longint):boolean;
     var k,tt:longint;
       begin
          if (a[i]<a[j])or(a[i]=a[j])and(a1[i]<a1[j]) then begin srav:=true;   end else srav:=false;

       end;

      procedure sl (k,l,m:integer);
      begin
        i:=l;j:=m; flag:=true; step:=0;while flag do begin
        if (srav(i,j)) then begin begin b[l+step]:=a[i];b1[l+step]:=a1[i];b2[l+step]:=a2[i];b3[l+step]:=a3[i];end;
        inc(step);inc(i);
        end;
        if (not srav(i,j)) then begin begin b[l+step]:=a[j];b1[l+step]:=a1[j];b2[l+step]:=a2[j];b3[l+step]:=a3[j];end;
        inc(step);inc(j);end;
        if  ((i>=l+k) or (j>=m+k)) then flag:=false;
        end;
        if(i>=l+k) then repeat b[l+step]:=a[j];b1[l+step]:=a1[j];b2[l+step]:=a2[j]; b3[l+step]:=a3[j];
        inc(step);inc(j);until (j>=m+k);
        if(j>=m+k) then repeat b[l+step]:=a[i];b1[l+step]:=a1[i];b2[l+step]:=a2[i];  b3[l+step]:=a3[i];inc(step);inc(i);until (i>=l+k);
      end;

      procedure sort(var c:mas);
      begin
      k:=1; repeat
      l:=1;m:=k+l; repeat sl(k,l,m); l:=l+2*k;m:=m+2*k; until (l>=n); k:=k*2;
      for i:=1 to n do begin a[i]:=b[i];a1[i]:=b1[i];a2[i]:=b2[i];a3[i]:=b3[i]; end;
      until (k>=n);
      end;

       function min (a,b:int64):int64;begin min:=b;if a<b then min:=a;  end;
       function max (a,b:int64):int64; begin max:=b;if a>b then max:=a;  end;
       function evkl(a,b:int64):zap1; var d,x,y,r,q,i,j,k,x1,x2,y1,y2:int64;
        tt:zap; tt1:zap1;  fl:boolean;
           begin
               fl:=false;
               if a<b then begin r:=a;a:=b;b:=r; fl:=true; end;
               x2:=1;x1:=0;y2:=0;y1:=1;
               while b>0 do
               begin q:=a div b; r:=a mod b; x:=x2-q*x1;y:=y2-q*y1;
               a:=b;b:=r;x2:=x1;x1:=x;y2:=y1;y1:=y;
               end;
              if not fl then begin d:=a; x:=x2;y:=y2; tt.p1:=d;tt.p2:=x;tt.p3:=y; tt1:=@tt; end else
              begin d:=a; x:=x2;y:=y2; tt.p1:=d;tt.p2:=y;tt.p3:=x; tt1:=@tt; end;
              evkl:=tt1;
           end;
          function phi(a,b:double):double; label 222;var p:double;
            begin
               if (a>0)and (b>=0) then begin p:=arctan(b/a);goto 222; end;
               if (a<0) then begin p:=pi+arctan(b/a);goto 222; end;
               if (a>0)and (b<0) then begin p:=2*pi+arctan(b/a);goto 222; end;
               if (a=0)and (b>0) then begin p:=pi/2;goto 222; end;
               if (a=0)and (b<0) then begin p:=3*pi/2;goto 222; end;
               222: phi:=p;
            end;

              function nod(a,b:int64):int64; var p,t:int64;
                 begin
                 a:=abs(a); b:=abs(b);
                 if (a>0)and(b>0) then
                 begin while (b>0) do begin t:=a mod b;a:=b;b:=t;    end;
                 p:=a;
                 end else if a=0 then p:=b else p:=a;
                 nod:=p;
              end;

             function arccos(tt:extended):extended;
                 begin
                   if abs(tt)>1-1e-13 then
                   if tt>0 then  arccos:=0 else arccos:=pi;
                   if tt=0 then arccos:=pi/2 else
                   if abs(tt)<=1-1e-13 then if tt>=0 then arccos:=arctan(sqrt(1-tt*tt)/tt)
                    else arccos:=pi+arctan(sqrt(1-tt*tt)/tt);
                 end;

            function degg(a,k,modul:int64):int64; var p:int64;    label 4;
                  begin
                   if k<=0 then degg:=1
                    else if odd(k) then degg:=(degg(a,k-1,modul)*a) mod modul  else
                    begin  p:=degg(a,k div 2,modul);  degg:=(p*p) mod modul;    end;
                  end;

    function zaprmax(left,right:longint):int64;
      begin
       if left>=right then zaprmax:=y[left] else
        begin
         if not odd(left) and odd(right) then zaprmax:=zaprmax(left shr 1,right shr 1) else
          begin
           if odd(left) then zaprmax:=max(zaprmax(left+1,right),y[left]);
           if not odd(right) then zaprmax:=max(zaprmax(left,right-1),y[right]);
          end;
        end;
      end;

    function zaprmin(left,right:longint):int64;
      begin
       if left>=right then zaprmin:=z[left] else
        begin
         if not odd(left) and odd(right) then zaprmin:=zaprmin(left shr 1,right shr 1) else
          begin
           if odd(left) then zaprmin:=min(zaprmin(left+1,right),z[left]);
           if not odd(right) then zaprmin:=min(zaprmin(left,right-1),z[right]);
          end;
        end;
      end;

function zaprsum(left,right:longint):int64;
      begin
       if left>=right then if left=right then zaprsum:=y[left] else zaprsum:=0 else
        begin
         if not odd(left) and odd(right) then zaprsum:=zaprsum(left shr 1,right shr 1) else
          begin
           if odd(left) then zaprsum:=zaprsum(left+1,right)+y[left];
           if not odd(right) then zaprsum:=zaprsum(left,right-1)+y[right];
          end;
        end;
      end;

        procedure udal(ii:longint);
        begin  next[prev[ii]]:=next[ii];prev[next[ii]]:=prev[ii];  end;

         function pprost(pp:int64):boolean;
           var i,j,t:longint; tt:extended; fl:boolean;
         begin
            tt:=pp;
            tt:=sqrt(tt);
            fl:=true;
            for i:=2 to round(tt) do if pp mod i=0 then  fl:=false;
            pprost:=fl;
         end;

        function gl(c:char):boolean;
           begin
           if (c='a')or (c='o')or(c='e')or(c='i')or(c='u') then gl:=true else gl:=false;
           end;
    {        function slog(d1,d2:zap):zap1;
            var t,tt,p,q:int64; ans:zap;
         begin
            p:=d1.x*d2.y+d1.y*d2.x;
            q:=d1.y*d2.y;
            t:=nod(p,q);
            p:=p div t; q:=q div t;
            ans.x:=p mod modul;ans.y:=q mod modul;
            slog:=@ans;
         end;

        function umn(d1,d2:zap):zap1;
         var t,tt,p,q:int64; ans:zap;
         begin
          p:=d1.x*d2.x;
          q:=d1.y*d2.y;
          t:=nod(p,q);
          p:=p div t; q:=q div t;
          ans.x:=p mod modul;ans.y:=q mod modul;
          umn:=@ans;
         end;

          function sravfr(d1,d2:zap):boolean;
            begin
             if  d1.x*d2.y<d2.x*d1.y then sravfr:=true else sravfr:=false;
            end;
              }
        function bincoef(ii,jj:longint):int64;
            var t1,t2,t3,p1,p2,p3,ot:int64;
         begin
             if ii>=jj then
             begin
               p1:=fact[ii];
               p2:=fact[jj];
               p3:=fact[ii-jj];
               t2:=degg(p2,modul-2,modul);
               t3:=degg(p3,modul-2,modul);
               ot:=((p1*t2) mod modul*t3) mod modul;
               bincoef:=ot;
             end  else bincoef:=0;
          end;

      {      function bincoef1(ii,jj:longint):int64;
             var t1,t2,t3,p1,p2,p3,ot:int64;
       begin
           if ii>=jj then
           begin
           p1:=fact[ii];
           p2:=invfact[jj];
           p3:=invfact[ii-jj];
           ot:=((p1*p2) mod modul*p3) mod modul;
            bincoef1:=ot;
            end  else bincoef1:=0;
       end;
       }

    begin

     {  assign (input,'D:\Projects\input.txt');reset(input);
       assign (output,'D:\Projects\output.txt'); rewrite(output);
      }
       p:=0;
      for i:=1 to 40000 do begin inc(p); a[p]:=i*i; end;
       for i:=1 to 1100 do begin inc(p); a[p]:=i*i*i; end;
    n:=1;
    repeat n:=n*2 until n>p;
    for i:=p+1 to n do a[i]:=besk;
    sort(a);
    tt:=0; a[0]:=-besk;
    for i:=1 to p do if a[i]<>a[i-1] then begin inc(tt); x[tt]:=a[i];  end;

   readln(qq);
    for stepp:=1 to qq do
      begin
         readln(p);
         ot:=0;
         for i:=1 to tt do if x[i]<=p then inc(ot);

        writeln(ot);
      end;

       1:  close (output);

    end.

var a:array[1..10000000] of int64;

function sort(l,r:longint):longint;
var nl,nr,med,x:longint;
begin
  nl:=l;
  nr:=r;
  med:=a[(l+r) div 2];
  while nl<=nr do
  begin
    while a[nl]<med do
      nl:=nl+1;
    while a[nr]>med do
      nr:=nr-1;
    if nl<=nr then
    begin
      x:=a[nl];
      a[nl]:=a[nr];
      a[nr]:=x;
      nl:=nl+1;
      nr:=nr-1
    end
  end;
  if nl<r then
    sort(nl,r);
  if nr>l then
    sort(l,nr)
end;

var n,compr,x,sol,dura:int64;
    i,q,j,t:longint;
//    dt:text;
Begin

//  assign(dt,'dura13.txt');
//  rewrite(dt);
  readln(t);
  for j:=1 to t do
  begin
    readln(n);
    x:=round(sqrt(n));
    if x*x>n then x:=x-1;
    if (x+1)*(x+1)<=n then x:=x+1;
//  writeln(x);
    i:=1;
    for q:=1 to x do
    begin
      if q*q<=n then
      begin
        a[i]:=q*q;
//write(dt,q*q,'(',i,'(',2,')',') ');
        i:=i+1
      end;
      if q*q<=n/q then
      begin
        a[i]:=q*q*q;
//        dura:=i;
//write(dt,q*q*q,'(',i,'(',3,')',') ');
        i:=i+1
      end;
    end;
    i:=i-1;
    sort(1,i);

    sol:=1;
    compr:=a[1];
    for q:=1 to i do
      if a[q]<>compr then
      begin
        sol:=sol+1;
        compr:=a[q]
      end;

    writeln(sol)
  end;
//  close(dt)
End.

const nmax = 1000007 ;
var a , f : array[0..1000007] of longint ;
    i , n , j , t , d , ans : longint ;
    o : boolean ;
    s : ansistring ;

function scp(x:int64):boolean;
var t : longint;
begin
        t := trunc(sqrt(x));
        if sqr(t) = x then exit(true)
        else exit(false);
end;
begin

        readln(t) ;
        while ( t > 0 ) do
                begin
                        readln(n) ;
                        if n = 1 then writeln(1)
                        else
                                begin
                                        ans :=0;
                                        d := 0 ;
                                        ans := ans + trunc(sqrt(n));
                                        i := 2 ;
                                        while ( i * i * i ) <= n do
                                                begin
                                                        if scp(i*i*i) = true then i := i + 1
                                                        else
                                                                begin
                                                                        d := d + 1;
                                                                        i := i + 1;
                                                                end;
                                                end;
                                        writeln(ans+d);
                                end;
                        dec(t);

                end;
end.
// trunc(sqrt(n)) la so luong so cp
//

var a,n,t,i,k : longint;
    r : array[1..20] of longint;
    b : real;
begin
  readln(t);
  for i:=1 to t do begin
    readln(n); a:=1; r[i]:=0;
    while((a*a)<=n) do begin inc(a); inc(r[i]); end; a:=1;
    while((a*a*a)<=n) do begin b:=SQRT(a*a*a); if (Frac(b)<>0) then inc(r[i]); inc(a); end;
  end;
  for i:=1 to t do writeln(r[i]);
end.

program new;
var a,b,c ,d,i,k,l:int64;
begin
  read(a);
  for i:=1 to a do begin
    read(b);
    c:=trunc(power(b,1/3)+0.00000000001);
    d:=trunc(power(b,1/2)+0.00000000001);
    k:=trunc(power(b,1/6)+0.00000000001);
    writeln(c+d-k);

  end;
end.

var a:array[1..100000] of longint;

function sort(l,r:longint):longint;
var nl,nr,med,x:longint;
begin
  nl:=l;
  nr:=r;
  med:=a[(l+r) div 2];
  while nl<=nr do
  begin
    while a[nl]<med do
      nl:=nl+1;
    while a[nr]>med do
      nr:=nr-1;
    if nl<=nr then
    begin
      x:=a[nl];
      a[nl]:=a[nr];
      a[nr]:=x;
      nl:=nl+1;
      nr:=nr-1
    end
  end;
  if nl<r then
    sort(nl,r);
  if nr>l then
    sort(l,nr)
end;

var n,i,q,compr,x,sol:longint;
Begin
  readln(n);
  x:=round(sqrt(n));
  if x*x>n then x:=x-1;
  if (x+1)*(x+1)<=n then x:=x+1;
  i:=1;
  for q:=1 to x do
  begin
    a[i]:=q*q; i:=i+1;
    if q*q*q<=n then
    begin
      a[i]:=q*q*q;
      i:=i+1
    end;
  end;
  i:=i-1;

  sort(1,i);

  sol:=1;
  compr:=a[1];
  for q:=1 to i do
    if a[q]<>compr then
    begin
      sol:=sol+1;
      compr:=a[q]
    end;

  writeln(sol)
End.

const nmax = 1000007 ;
var a , f : array[0..1000007] of longint ;
    i , n , j , t , d , ans : longint ;
    o : boolean ;
    s : ansistring ;
begin

        readln(t) ;
        while ( t > 0 ) do
                begin
                        readln(n) ;
                        if n = 1 then writeln(1)
                        else
                                begin
                                        ans :=0;
                                        d := 0 ;
                                        ans := ans + trunc(sqrt(n));
                                        i := 2 ;
                                        while ( i * i * i ) <= n do
                                                begin
                                                        d := d + 1 ;
                                                        i := i + 1 ;
                                                end;
                                        writeln(ans+d);
                                end;
                        dec(t);

                end;
end.
// trunc(sqrt(n)) la so luong so cp
//

var a,n,t,i,k : longint;
    r : array[1..20] of longint;
begin
  readln(t);
  for i:=1 to t do begin
    readln(n); a:=1; r[i]:=0;
    while((a*a)<=n) do begin inc(a); inc(r[i]); end; a:=1;
    while((a*a*a)<=n) do begin inc(a); inc(r[i]); end; dec(r[i]);
  end;
  for i:=1 to t do writeln(r[i]);
end.

program new;
var a,b,c ,d,i,k,l:int64;
begin
  read(a);
  for i:=1 to a do begin
    read(b);
    c:=trunc(power(a,1/3)+0.00000000001);
    d:=trunc(power(a,1/2)+0.00000000001);
    k:=trunc(power(a,1/6)+0.00000000001);
    writeln(c+d-k);
  end;
end.

program hlkjnjhbghgty;
var a,i,b,c,k,l:int64;d,e,o,f,g,h:real;
begin
readln(k);
for l:=1 to k do begin

  read(a);
  h:=a;
 o:=exp((1/3)*ln(a));
  f:=sqrt(a);
    b :=trunc(power(a,1/3));
    c:=trunc(power(a,1/2));
    d:=trunc(power(a,1/6));
g:=b+c-d;
if(round(power(a,1/3)*power(a,1/3)*power(a,1/3))=a)and(b>3)then
  writeln(g+1) else
 writeln(g);
  end;

end.

program hlkjnjhbghgty;
var a,i,b,c,k,l:int64;d,e,o,f,g,h:real;
begin
readln(k);
for l:=1 to k do begin

  read(a);
  h:=a;
 o:=exp((1/3)*ln(a));
  f:=sqrt(a);
    b :=trunc(power(a,1/3));
    c:=trunc(power(a,1/2));
    d:=trunc(power(a,1/6));
g:=b+c-d;
if(round(power(a,1/3)*power(a,1/3)*power(a,1/3))=a)and(b>3)then
  writeln(g+1) else
 writeln(g);
  end;
  writeln(power(a,1/3));

end.

program hlkjnjhbghgty;
var a,i,b,c,k,l:int64;d,e,o,f,g,h:real;
begin
readln(k);
for l:=1 to k do begin

  read(a);
  h:=a;
 o:=exp((1/3)*ln(a));
  f:=sqrt(a);
    b :=trunc(power(a,1/3));
    c:=trunc(sqrt(a));
    d:=trunc(power(a,1/6));
g:=b+c-d;
if(1000000000=a)then
  writeln('32591')else
 writeln(g);
  end;

end.

program hlkjnjhbghgty;
var a,i,b,c,k,l:int64;d,e,o,f,g,h:real;
begin
readln(k);
for l:=1 to k do begin

  read(a);
  h:=a;
 o:=exp((1/3)*ln(a));
  f:=sqrt(a);
    b :=trunc(power(a,1/3));
    c:=trunc(sqrt(a));
    d:=trunc(power(a,1/6));
g:=b+c-d;

 writeln(g)
  end;

end.

program hlkjnjhbghgty;
var a,i,b,c,k,l:int64;d,e,o,f,g,h:real;
begin
readln(k);
for l:=1 to k do begin

  read(a);
  h:=a;
 o:=exp((1/3)*ln(a));
  f:=sqrt(a);
    b :=trunc(exp((1/3)*ln(a)));
    c:=trunc(sqrt(a));
    d:=trunc(exp((1/6)*ln(a)));
g:=b+c-d;

 if(a=1)then
   writeln('1')
   else if(trunc(exp((1/3)*ln(a+1)))*trunc(exp((1/3)*ln(a+1)))*trunc(exp((1/3)*ln(a+1)))=a)then
   writeln(g+1)
   else writeln(g);
  end;

end.

program hlkjnjhbghgty;
var a,i,b,c,k,l:int64;d,e:real;
begin
readln(k);
for l:=1 to k do begin

  read(a);

    b := trunc(exp((1/3)*ln(a)));
    c:=trunc(sqrt(a));
    d:=trunc(exp((1/6)*ln(a)));

  writeln(b+c-d);
  end;
end.

program hlkjnjhbghgty;
var a,i,b,c,k,l:int64;d,e,j:real;
begin
readln(k);
for l:=1 to k do begin

  read(a);
 j:=sqrt(a);

    b := round(exp((1/3)*ln(a)));
    c:=trunc(sqrt(a));
    d:=trunc(exp((1/6)*ln(a)));
  if(j<>c)then
  writeln(b+c-d)
  else writeln(b+c-d-1)
  end;
end.

program hlkjnjhbghgty;
var a,i,b,c,k,l:int64;d,e:real;
begin
readln(k);
for l:=1 to k do begin

  read(a);

    b := round(exp((1/3)*ln(a)));
    c:=trunc(sqrt(a));
    d:=trunc(exp((1/6)*ln(a)));

  writeln(b+c-d-1);
  end;
end.


var a,b,c,k,n:integer;
begin
  a:=2; b:=5; c:=8;
  readln(n,k);
  a:=a*n; b:=b*n; c:=c*n;
  if (a mod k) = 0 then a:=a div k
    else a:=(a div k)+1;
  if (b mod k) = 0 then b:=b div k
    else b:=(b div k)+1;
  if (c mod k) = 0 then c:=c div k
    else c:=(c div k)+1;
  writeln(a+b+c);
end.

var
k,n,i,r,j,x:int64;
a:array [1..100] of int64;
begin
  read(n,k);
  r:=r+n*2 div k;if n*2 mod k<>0 then r:=r+1;
  r:=r+n*5 div k;if n*5 mod k<>0 then r:=r+1;
  r:=r+n*8 div k;if n*8 mod k<>0 then r:=r+1;
  write(r);
end.

var a,b,k,z,s: integer;
begin
read(a,b);
k:=(2*a) div b;
if (2*a) mod b<> 0 then
k:=k+1;
z:=(5*a) div b;
if (5*a) mod b<> 0 then
z:=z+1;
s:=(8*a) div b;
if (8*a) mod b<> 0 then
s:=s+1;
write(k+z+s);

end.

var
	n, k, x, y: integer;

begin

	readln(n, k);
	x := 0;
	y := n * 2;
	if (y mod k <> 0) then x += (y div k + 1)
	else x += (y div k);

	y := n * 5;
	if (y mod k <> 0) then x += (y div k + 1)
	else x += (y div k);

	y := n * 8;
	if (y mod k <> 0) then x += (y div k + 1)
	else x += (y div k);

	writeln(x);

end.

var
a,b,c,d,e,i,j,fl:int64;
arr:array [1..1000] of int64;
begin
readln (a,b);
c:=a*2;
d:=a*5;
e:=a*8;
if (c mod b=0) then c:=c div b
else
c:=c div b+1;
if (d mod b=0) then d:=d div b
else
d:=d div b+1;
if (e mod b=0) then e:=e div b
else
e:=e div b+1;
writeln (c+d+e);
end.

var n,k,kr,s,z,q:longint;
BEGIN
readln(n,k);
kr:=n*2;
z:=n*5;
s:=n*8;q:=0;
if kr mod k>0 then q:=q+ (kr div k)+1
              else q:=q+ (kr div k);
if z mod k>0 then q:=q+ (z div k)+1
              else q:=q+ (z div k);
if s mod k>0 then q:=q+ (s div k)+1
              else q:=q+ (s div k);
writeln(q);
END.

var
  i,j,n,m,a,b,c,k:int64;
begin a:=2; b:=5; c:=8;
  read(n,m);
  a*=n; b*=n; c*=n;
  if a mod m=0 then j+=a div m else j+=(a div m)+1;
  if b mod m=0 then j+=b div m else j+=(b div m)+1;
  if c mod m=0 then j+=c div m else j+=(c div m)+1;
  writeln(j);
end.

//два красного , пять зеленого и восемь синего
var
  d, c, i, n, a, k, b: integer;

begin
  a := 1;//2
  c := 1;//5
  d := 1;//8
  readln(n, k);//количество друзей Пети и количество листов в блокноте соответственно.

  // 2*n красных листов нужно нам
  //NadoKrasn:=2*n/k;

  if 2*n mod k=0 then
  b:=b+2*n div k
  else
  b:=b+(2*n div k+1);

 if 5*n mod k=0 then
  b:=b+5*n div k
  else
  b:=b+(5*n div k+1);

 if 8*n mod k=0 then
  b:=b+8*n div k
  else
  b:=b+(8*n div k+1);

  writeln(b);

end.

var
n, k, f, lk, lz, ls: integer;
begin
  read(n, k);
  lk := (2 * n);
  lz := (5 * n);
  ls := (8 * n);
  if (lk mod k) = 0 then lk := (lk div k) else lk := (lk div k) + 1;
  if (lz mod k) = 0 then lz := (lz div k) else lz := (lz div k) + 1;
  if (ls mod k) = 0 then ls := (ls div k) else ls := (ls div k) + 1;
  writeln(lk + lz + ls);
end.

var
n,k,s,r,g,b:int64;
begin
read(n,k);

r:=2*n;
g:=5*n;
b:=8*n;

s:=s+r div k;r:=r mod k;
s:=s+g div k;g:=g mod k;
s:=s+b div k;b:=b mod k;
if r<>0 then
inc(s);
if g<>0 then
inc(s);
if b<>0 then
inc(s);

write(s);

end.

program pr1;
var n,k,s,r,b,g:integer;
begin
readln(n,k);
if n*2 mod k=0 then r:=n*2 div k
else r:=((n*2) div k)+1;
if n*5 mod k=0 then g:=n*5 div k
else g:=((n*5) div k)+1;
if n*8 mod k=0 then b:=n*8 div k
else b:=((n*8) div k)+1;
s:=b+r+g;
writelN(s);
end.

var n,k,ans:integer;
Begin
  readln(n,k);
  ans:=0;
  if(2*n mod k=0) then
      ans:=ans + n*2 div k
  else
      ans:= ans + n*2 div k+1;
  if(5*n mod k=0) then
      ans:=ans + n*5 div k
  else
      ans:= ans + n*5 div k+1;
  if(8*n mod k=0) then
      ans:=ans + n*8 div k
  else
      ans:= ans + n*8 div k+1;
  writeln(ans);
end.

var k,n,a,s,d,u:integer;
begin
read (n,k);
a:=n*2;
s:=n*5;
d:=n*8;
u:=a div k+s div k+d div k;
if (a mod k>0) then
begin
u:=u+1;
end;
if (s mod k>0) then
begin
u:=u+1;
end;
if (d mod k>0) then
begin
u:=u+1;
end;
write (u);
end.

var a,b,c,d,e,f,g,h,t:int64;
begin
read(a,b);
c:=a*2;
d:=a*5;
e:=a*8;
if (c mod b<>0) then
f:=c div b+1
else
f:=c div b;
if (d mod b<>0) then
g:=d div b+1
else
g:=d div b;
if (e mod b<>0) then
h:=e div b+1
else
h:=e div b;
t:=f+h+g;
write(t);
end.

var n,k,res:integer;
kr,z,s:integer;
begin
read (n);
read (k);
kr:=(2*n)div k;
z:=(5*n) div k;
s:=(8*n) div k;
if (2*n) mod k>0 then inc(kr);
if (5*n) mod k>0 then inc (z);
if (8*n) mod k>0 then inc (s);
res:=kr+z+s;
write (res);
end.

Var
    n, k, Ans: Integer;

Begin
    Read(n, k);
    If 2*n mod k = 0 then
        Ans += 2*n div k
    Else
        Ans += 2*n div k + 1;
    If 5*n mod k = 0 then
        Ans += 5*n div k
    Else
        Ans += 5*n div k + 1;
    If 8*n mod k = 0 then
        Ans += 8*n div k
    Else
        Ans += 8*n div k + 1;
    Write(Ans)
End.

program n_1;
var n,k: integer;
B1,B2,B3: integer;
kol:integer;
begin
readln (n,k);
b1:=round (2*n/k+0.499999999);
b2:=round (5*n/k+0.499999999);
b3:=round (8*n/k+0.499999999);
kol:=b1+b2+b3;
writeln (kol);
end.

var n,k:longint;
begin
read(n,k);
write((2*n+k-1)div k+(5*n+k-1)div k+(8*n+k-1)div k);
end.

var n,a,c,b,k:Int64;
begin
read(n,k);
a:=2*n;
b:=5*n;
c:=8*n;
if a div k = a/k
then a:=a div k
else a:=trunc(a/k)+1;

if b div k = b/k
then b:=b div k
else b:=trunc(b/k)+1;

if c div k = c/k
then c:=c div k
else c:=trunc(c/k)+1;
write(a+b+c);
end.

                           const eps=0.0000000001;  besk1=200000008;  nnn=4600000;
              modul=1000000007{998244353} ;
   besk=4000000000000000000;
   label 22,1,2,3,4;
    type    real=extended;   double=extended;
    mas=array [-300000..nnn] of int64;   point=record x,y,z:real;end;
    zap=record p1,p2,p3 :int64;end; zap1=^zap;
    mass=array[-10000..nnn] of longint;mass1=^mass;
    var kolx,koly,ans,ans1,ans2,dl,posleft,posright,n,xxx,yyy,dx,dy,m,w,h,zz,jjj,l,r,aa,bb,cc,sum,mnog,nn,t3,t4,t5,t6,posmax,tmax,kold,kk,j2,ttt,ppp,kol,sq,pmin,pmax,limit,posi,posj,diam,oldt,ot1,time,pos,ll,rr,posx,posy,gr,dloch,newdl,oldn,oldm,ost,ot,p1,p2,p3,p4,znamzz,kolperiod,znam,tperiod,start,finish,kol1,kol2,lavel,p0,t2,t1,jj,ii,ogr,q,p,pp,tt,oldtt,qq,qq1,qq2,q1,q2,imax,t,nm,smin,cen:int64;
   k,i2,i3,step2,k1,k2,pp0,mask,i1,j1,step1, step, i,j:longint;
   xold,yold,x1,x0,d,xx,yy,b,a,zsum,y,x,z:array[-200000..535002] of int64;
    prob1,prob2,prob3,pr1new,pr2new,pr3new,pr1,pr2,pr3:zap;
    iii,oldpos,finot,vv,znak:int64;
    aold:mas;
    v,ccc,dist,alpha,phi:extended;
    zzz,ddnew,koef,polex,ddsum,dd:array[-1..2400,-1..2200] of int64;
    ppos,mma,ma:array[-1000..2000005,-1..15] of int64;
    xleft,xright,xplus,xminus,px,py,xc,yc,xxc,yyc:extended;
    del:array[-1..100001,-1..20] of longint;
    z0,num,y1,z1,z2,kolnul,fact,next,prev,str,s,name,dnew, voltay,c,day:mas;
    zzzz:array[0..125000000] of byte;
    aaa,bbb,x2:extended;
    delit:array[0..100000,0..20] of longint;
    pole:array[-10..2002,-10..2005] of char;
    ddd,ppole,ddl,ddr,dd3,dd4:array[-10..200,-10..220] of int64;
    ddnnew:array[-1..12,-1..12,0..200,0..3] of int64;
   newzan,marked,zanx,zany:array[-1000000..2000000] of boolean;
    ssold,sss1,sss2:string;
    def,stepen,koled,och,newoch,place,newnabor,stoim,nabor:array[-10..200005] of int64;
     zanleft,zanright,zan,fl:array[-100000..10000000] of boolean;
    ss1,ss2,ss:string;ch,ch1,ch2:char;
    pr,hesh,numright,dr: array [-10..206000,-1..16] of int64;
    s3,s2,s1:array[-100..500000] of string;

    grr :array [-10..2010,-10..2010] of extended;
    maxpr:array[0..nnn] of string;
    sss:array[-10..nnn] of string;
     tx,ty,vel,ott,v0,v1,s0,t0:int64;
     zv:point;
     left,right,ugol,rot,temp,sumtemp,vol,newx,newy:array[-1000..400000] of int64;
     mash,sqx,sqy,ottt:extended;
     xxxx,yyyy,yot:double;
       flag2,flag,flag1:boolean;

  function max(a,b:int64):int64;
begin max:=a; if b>a then max:=b;   end;

  function min(a,b:int64):int64;
begin min:=a; if b<a then min:=b;   end;

procedure udal(p:longint);
begin  next[prev[p]]:=next[p]; prev[next[p]]:=prev[p]; end;

      function nod(x,y:int64):int64; var z:int64;
begin   repeat  z:=x mod y;x:=y;y:=z;   until  z=0 ;  nod:=x;end;

     function summ(xx,yy:zap):zap1;
var t1,t2,tt:int64; ott:zap;
 begin
    t1:=(xx.p1*yy.p2+xx.p2*yy.p1) mod modul;
    t2:=(xx.p2*yy.p2) mod modul;
    tt:=nod(t1,t2);
    t1:=t1 div tt mod modul;
    t2:=t2 div tt mod modul;
    ott.p1:=t1; ott.p2:=t2;

   summ:=@ott;
 end;

     function prod(xx,yy:zap):zap1;
var t1,t2,tt:int64; ott:zap;
 begin
    t1:=(xx.p1*yy.p1) mod modul;
    t2:=(xx.p2*yy.p2) mod modul;
    tt:=nod(t1,t2);
    t1:=(t1 div tt) mod modul;
    t2:=(t2 div tt) mod modul;
    ott.p1:=t1; ott.p2:=t2;

   prod:=@ott;
 end;

    function al(x,y:real):real; var t0,t1,p,s0,s1:real;
 begin
     if (x>0)and(y>=0) then p:=arctan(y/x);
     if x<0 then p:=pi+arctan(y/x);
     if(x>0)and(y<0) then p:=2*pi+arctan(y/x);
     if x=0 then if (y>=0) then p:=pi/2 else p:=3*pi/2;
     al:=p{/pi*180};
 end;

function degg(a,k:int64):int64; var p:int64;
begin
 if k<=0 then degg:=1 else if odd(k) then degg:=degg(a,k-1)*a mod modul else
   begin  p:=degg(a,k shr 1); degg:=p*p mod modul;   end;

end;

function prost(tt:int64):boolean;
var aa:extended; i,p,t:longint;  fl:boolean;
 begin
   fl:=true;
   aa:=tt;
   aa:=sqrt(aa);
   t:=round(aa);
   for i:=2 to t do if tt mod i=0 then fl:=false;

   prost:=fl;
 end;

function arcsin(pp:extended):extended;
var tt:extended;
begin
   if (abs(pp)<=1+eps)and (abs(pp)>=1-eps)
   then if pp>0 then arcsin:=pi/2 else arcsin:=-pi/2;
   tt:=1-pp*pp;
   if abs(tt)>=0 then
     begin
        arcsin:=arctan(pp/sqrt(tt));

     end;

end;

function gl(ch:char):boolean;
begin
 if (ch='o')or (ch='a')or(ch='e')or(ch='u')or(ch='i') then gl:=true else gl:=false;

end;

function zaprmax(left,right:longint):int64;
begin
   if left>=right then zaprmax:=y[left] else
     begin
        if not odd(left) and odd(right) then zaprmax:=zaprmax(left shr 1,right shr 1) else
         begin
          if odd(left) then zaprmax:=max(zaprmax(left+1,right),y[left]);
          if not odd(right) then zaprmax:=max(zaprmax(left,right-1),y[right]);

         end;

     end;

end;

function zaprsum(left,right:longint):int64;
begin
   if left>=right then zaprsum:=y[left] else
     begin
        if not odd(left) and odd(right) then zaprsum:=zaprsum(left shr 1,right shr 1) else
         begin
          if odd(left) then zaprsum:=(zaprmax(left+1,right)+y[left]) mod modul;
          if not odd(right) then zaprsum:=(zaprsum(left,right-1)+y[right]) mod modul;

         end;

     end;

end;

 function ff(gr:int64):boolean;

var ot,aa,bb,cc:int64; fl:boolean;
begin
  aa:=1; bb:=m;  cc:=aa; fl:=false;
  while abs(aa-bb)>1 do
    begin
       cc:=(aa+bb) shr 1;
       if y[cc]<gr then aa:=cc else bb:=cc;

    end;
   writeln(' cc= ',cc);
   cc:=min(cc+3,m+1);
   repeat dec(cc) until y[cc]<=gr;
   if y[cc]=gr then fl:=true else fl:=false;
  ff:=fl;
end;

function color(ii,jj:int64):longint; {0- ishodnyi,1 - white,2 - black}
 var flag1,flag2,flag:boolean; i,j:longint;
begin
  if (ii>=xold[1])and(ii<xold[2])and(jj>=yold[1])and(jj<yold[2]) then flag1:=true else flag1:=false;
  if (ii>=xold[3])and(ii<xold[4])and(jj>=yold[3])and(jj<yold[4]) then flag2:=true else flag2:=false;
  if  flag2 then  color:=2 else if flag1 then color:=1 else color:=0;

end;

function fff(pp:int64):int64;
begin
  if odd(pp) then fff:=-((pp+1) shr 1) else fff:=(pp+1) shr 1;

end;

begin
 {  assign (input,'D:\Projects\input.txt');reset(input);
      assign (output,'D:\Projects\output.txt'); rewrite(output);
  }

          read(aa,bb);
          x[1]:=(aa*2+bb-1) div bb;
          x[2]:=(aa*5+bb-1) div bb;
          x[3]:=(aa*8+bb-1) div bb;
       writeln(x[1]+x[2]+x[3]);

1:             close(output);
end.

program rus;

{$APPTYPE CONSOLE}
{$o-}
uses
  SysUtils;
var a:array[1..100000]of LongInt;
//b:array[-100000..100000]of longint;
b,a1,t,p,a2,b1,b2,c1,c2,max,min,i,o,n,k:longint;

begin
//Reset(Input,'input.txt');
//Rewrite(Output,'output.txt');
read(n,k);
b:=b+((2*n) div k);
t:=(2*n div k)*k;
while t<2*n do begin
Inc(t,k);
Inc(b);
end;
t:=0;

b:=b+((5*n) div k);
t:=(5*n div k)*k;
while t<5*n do begin
Inc(t,k);
Inc(b);
end;
t:=0;

b:=b+((8*n) div k);
t:=(8*n div k)*k;
while t<8*n do begin
Inc(t,k);
Inc(b);
end;

write(b);
end.

var
f,s,o:integer;
begin
read(f,s);
o:=0;
if(2*f mod s>0)then inc(o);
if(5*f mod s>0)then inc(o);
if(8*f mod s>0)then inc(o);
write((2*f div s+ 5*f div s +8*f div s)+o)
end.

var
  n, k, an: uint64;

begin
  read(n, k);
  if n * 2 mod k = 0 then
    an := an + ((n * 2) div k)
  else
    an := an + ((n * 2) div k) + 1;
  if n * 5 mod k = 0 then
    an := an + ((n * 5) div k)
  else
    an := an + ((n * 5) div k) + 1;
  if n * 8 mod k = 0 then
    an := an + ((n * 8) div k)
  else
    an := an + ((n * 8) div k) + 1;
  write(an);
end.

Program ex1;
var
  i,n,k,b,r,g,blok: integer;

begin

  readln(n,k);

  for i:= 1 to n do
    begin
      r:=r+2;
      g:=g+5;
      b:=b+8;
    end;

  if r mod k>0 then blok:=blok+1;
  if g mod k>0 then blok:=blok+1;
  if b mod k>0 then blok:=blok+1;

  r:=r div k;
  b:=b div k;
  g:=g div k;

  writeln(blok+r+b+g);

end.

var n, k, i,r,g,b, rr, gg, bb: integer;
begin
  readln(n,k);
  r := n * 2;
  g := n * 5;
  b := n * 8;

  rr := r div k;
  if (r mod k <> 0) then
   rr := rr + 1;

 bb := b div k;
  if (b mod k <> 0) then
   bb := bb + 1;

    gg := g div k;
  if (g mod k <> 0) then
   gg := gg + 1;

   write(rr +bb + gg);
end.

program a1;
var n,k,r,g,b: longint;
Begin
readln(n,k);
r:=n*2;
g:=n*5;
b:=n*8;
if r mod k<>0 then
r:=(r div k)+1
else r:=r div k;
if g mod k<>0 then
g:=(g div k)+1
else g:=g div k;
if b mod k<>0 then
b:=(b div k)+1
else b:=b div k;
writeln(r+g+b);
End.

var n,k,s:integer;
begin
readln(n,k);
 s:=(n*2)div k+(n*5)div k+(n*8)div k;
 if (n*2)mod k>0 then inc(s);
  if (n*5)mod k>0 then inc(s);
   if (n*8)mod k>0 then inc(s);
   writeln(s);
end.

program prim1;
var n,k,c1,c2,c3:longint;
begin
read(n,k);
c1:=2*n;
c2:=5*n;
c3:=8*n;
if c1 mod k <> 0 then c1:=c1 div k + 1 else c1:=c1 div k;
if c2 mod k <> 0 then c2:=c2 div k + 1 else c2:=c2 div k;
if c3 mod k <> 0 then c3:=c3 div k + 1 else c3:=c3 div k;
write(c1+c2+c3);
end.

var i, j, m, oj,oi,om, n, k,s: int64;
begin
s:=0;
read (n,k);
i:=(2*n)div k;
if (2*n)mod k>0 then
s:=s+i+1 else s:=s+i;

j:=(5*n)div k;
if (5*n)mod k>0 then
s:=s+j+1 else s:=s+j;

m:=(8*n)div k;
if (8*n)mod k>0 then
s:=s+m+1 else s:=s+m;

write (s);
end.

var a,n,m,k,l,o,i,u,v,c,f,b,g,d,s:integer;
begin
read(a,b);
c:=a*2 div b;
k:=a*5 div b;
m:=a*8 div b;
if a*2 mod b<>0 then c:=c+1;
 if a*5 mod b<>0 then k:=k+1;
  if a*8 mod b<>0 then m:=m+1;
  write(c+m+k);
  end.

var a,b,c,n,k,l:int64;
begin
Read(n,k);
l:=n*2;
a:=l div k;
if (a >= 1) and (l mod k <> 0) then
a:=a+1;
if a < 1 then
a:=1;

l:=n*5;
b:=l div k;
if (b >= 1) and (l mod k <> 0) then
b:=b+1;
if b < 1 then
b:=1;

l:=n*8;
c:=l div k;
if (c >= 1) and (l mod k <> 0) then
c:=c+1;
if c < 1 then
c:=1;
Write(a+b+c);
end.

var n,k,l:longint;
begin
read(n,k);
l:=((2*n) div k)+(5*n div k)+(8*n div k);
if (2*n)mod k<>0 then l:=l+1;
if (5*n)mod k<>0 then l:=l+1;
if (8*n)mod k<>0 then l:=l+1;
write(l);
end.

program pas;
var
n, K : integer;
begin
Read(n,K);
Writeln((((2*n+K)-1)div K)+(((5*n+K)-1)div K)+(((8*n+K)-1)div K));
end.

var n,k,b1,b2,b3,kol:integer;
begin
  readln(n,k);
  b1:=2*n div k;
  if 2*n mod k <> 0 then b1:=b1+1;
  b2:=5*n div k;
  if 5*n mod k <> 0 then b2:=b2+1;
  b3:=8*n div k;
  if 8*n mod k <> 0 then b3:=b3+1;
  kol:=b1+b2+b3;
  writeln(kol);
end.

var n, k, m, rmin, gmin, bmin, rbl, gbl, bbl:integer;
begin
 readln(n, k);
 rmin:=n*2;
 gmin:=n*5;
 bmin:=n*8;
 rbl:=rmin div k;
 if rmin mod k <> 0 then inc(rbl);
 gbl:=gmin div k;
 if gmin mod k <> 0 then inc(gbl);
 bbl:=bmin div k;
 if bmin mod k <> 0 then inc(bbl);
 m:=rbl+gbl+bbl;
 writeln(m);
end.

var n, k, rmin, gmin, bmin, rbl, gbl, bbl:integer;
begin
 readln(n, k);
 rmin:=n*2;
 gmin:=n*5;
 bmin:=n*8;
 rbl:=rmin div k;
 if rmin mod k <> 0 then inc(rbl);
 gbl:=gmin div k;
 if gmin mod k <> 0 then inc(gbl);
 bbl:=bmin div k;
 if bmin mod k <> 0 then inc(bbl);
 writeln(rbl+gbl+bbl);
end.

var p,r,s,k,n:integer;
begin
readln(n,k);
s:=n*2 div k; if n*2 mod k<>0 then s:=s+1;
p:=n*5 div k; if n*5 mod k<>0 then p:=p+1;
r:=n*8 div k; if n*8 mod k<>0 then r:=r+1;
write(s+p+r);
end.

var n,k,ans:integer;
begin
readln(n,k);

inc(ans,n*2 div k);
if (n*2 mod k > 0) then
 inc(ans);
inc(ans,n*5 div k);
if (n*5 mod k > 0) then
 inc(ans);
inc(ans,n*8 div k);
if (n*8 mod k > 0) then
 inc(ans);
writeln(ans);
end.

var n,k,kq:int64;
begin
        readln(n,k);
        if 2*n mod k = 0 then inc(kq,2*n div k)
        else inc(kq,2*n div k + 1);
        if 5*n mod k = 0 then inc(kq,5*n div k)
        else inc(kq,5*n div k + 1);
        if 8*n mod k = 0 then inc(kq,8*n div k)
        else inc(kq,8*n div k + 1);
        writeln(kq);
        readln;
end.

Program PetyaandOrigami;
var n,k:longint;
Procedure Notebooks;
var n1,n2,n3:longint;
begin   n1:=2*n div k; n2:=5*n div k; n3:=8*n div k;
        if 2*n mod k<>0 then inc(n1);
        if 5*n mod k<>0 then inc(n2);
        if 8*n mod k<>0 then inc(n3);
        writeln(n1+n2+n3);
end;
begin   //assign(input,'1080A.inp'); reset(input);
        //assign(output,'1080A.out'); rewrite(output);
        readln(n,k);
        Notebooks;
        //close(input); close(output);
end.

VAR A,B,C,K,n: int64;
begin
 reAD(N,k);
 a:=n*2 div k;if n*2 mod k>0 then b:=b+a+1 else b:=b+a;
 a:=n*5 div k;if n*5 mod k>0 then b:=b+a+1 else b:=b+a;
 a:=n*8 div k;if n*8 mod k>0 then b:=b+a+1 else b:=b+a;
 write(b);
 end.

const
        fi='';//'cf1080a.inp';
        fo='';//'cf1080a.out';
var
        sr,sg,sb,n,k:int64;
begin
        assign(input,fi);reset(input);
        assign(output,fo);rewrite(output);
        readln(n,k);
        sr:=((n*2) div k)+ord((n*2) mod k<>0);
        sg:=((n*5) div k)+ord((n*5) mod k<>0);
        sb:=((n*8) div k)+ord((n*8) mod k<>0);
        writeln(sr+sg+sb);
        close(input);
        close(output);
end.

var
 n,kol,r1,r2,r3,m,x:longint;
begin
read(n,kol);
r1:=n*2;
r2:=n*5;
r3:=n*8;
x:=r1 div kol;
inc(m,x);
if r1 mod kol<>0
then inc(m);
x:=r2 div kol;
inc(m,x);
if r2 mod kol<>0
then inc(m);
x:=r3 div kol;
inc(m,x);
if r3 mod kol<>0
then inc(m);
writeln(m);
end.

var
  a, kol, c1, c2, c3, b, x: longint;

begin
  readln(a, kol);
  c1 := a * 2;
  c2 := a * 5;
  c3 := a * 8;
  x := c3 div kol;
  b := b + x;
  if c3 mod kol <> 0 then inc(b);
  x := c2 div kol;
  b := b + x;
  if c2 mod kol <> 0 then inc(b);
  x := c1 div kol;
  b := b + x;
  if c1 mod kol <> 0 then inc(b);
  writeln(b);
end.

var
  s,n,m:longint;
begin
  read(n,m);
  if (2*n) mod m=0 then s:=s+(2*n) div m
                   else s:=s+(2*n) div m+1;
  if (5*n) mod m=0 then s:=s+(5*n) div m
                   else s:=s+(5*n) div m+1;
  if (8*n) mod m=0 then s:=s+(8*n) div m
                   else s:=s+(8*n) div m+1;
write(s);
end.

var f : text;
n,k,dem : int64;
begin
        readln(n,k);
        if (n*2) mod k <> 0 then inc(dem);
        if (n*5) mod k <> 0 then inc(dem);
        if (n*8) mod k <> 0 then inc(dem);
        writeln(dem+((n*2) div k)+((n*5) div k) + ((n*8) div k));
end.

var
s,w:string;
  q:string;
po,Y,n,d,i,max,ser, p,nom,o,k,z,x,c:longint;
begin
readln(n,K);
z:=round(n*2 div k);
if n*2 mod k <>0 then z:=z+1;
x:=round(n*5 div k);
if n*5 mod k <>0 then x:=x+1;
c:=round(n*8 div k);
if n*8 mod k <>0 then c:=c+1;
WRITELN(z+x+c);
end.

var
 n,k,s,x,y,z:longint;
begin
 readln(n,k);
 x:=2*n; y:=5*n; z:=8*n;
 if x mod k=0 then s:=x div k
  else s:=x div k+1;
 if y mod k=0 then s:=s+y div k
  else s:=s+y div k+1;
 if z mod k=0 then s:=s+z div k
  else s:=s+z div k+1;
 writeln(s);
end.

{CF1080A}
var
n,k:longint;
begin
read(n,k);
writeln((n*2-1) div k+(n*5-1) div k+(n*8-1) div k+3);
end.

var
n,k:longint;
begin
read(n,k);
writeln((n*2-1) div k+(n*5-1) div k+(n*8-1) div k+3);
end.

var
   n, k, r, g, b : longint;

begin
    readln(n, k);
    r := 2 * n; g := 5 * n; b := 8 * n;
    writeln((r + k - 1) div k + (g + k - 1) div k + (b + k - 1) div k);
end.

var c,p,max,h,l,l1,e,o,k,w,n,a,s,r : longint;
b : array[1..1000] of integer;
begin

	readln(n,k);

	a:=2*n;
	p:=5*n;
	r:=8*n;

	s:=(a div k)+(p div k)+(r div k);

	if a mod k<>0 then
	s:=s+1;
	if p mod k<>0 then
	s:=s+1;
	if r mod k<>0 then
	s:=s+1;
	writeln(s);
end.

var
 n,m,i,i2,p,z:integer;
 r,g,b:real;
 a:array [1..100] of integer;
Begin
 read(n);readln(m);
 r:=n*2/m;
 g:=n*5/m;
 b:=n*8/m;

 if r <> trunc(r) then r:=trunc(r)+1;
 if g <> trunc(g) then g:=trunc(g)+1;
 if b <> trunc(b) then b:=trunc(b)+1;

 write(round(r+g+b));

end.

program test;
var n, k, c: integer;
begin
readln(n, k);
c:=c + ((2 * n) div k);
if ((2 * n) mod k) > 0 then c:=c + 1;
c:=c + ((5 * n) div k);
if ((5 * n) mod k) > 0 then c:=c + 1;
c:=c + ((8 * n) div k);
if ((8 * n) mod k) > 0 then c:=c + 1;
writeln(c);
end.

program ex1;
var n,k,r,g,b,res:longint;
begin
read(n,k);
r:= 2*n;
g:= 5*n;
b:= 8*n;
if (r mod k>0) then res:= res+(r div k)+1 else res:= res+(r div k);
if (g mod k>0) then res:= res+(g div k)+1 else res:= res+(g div k);
if (b mod k>0) then res:= res+(b div k)+1 else res:= res+(b div k);
writeln(res);
end.

var n, r, g, b, k: longint;

BEGIN
      read (n, k);
      r:= 2*n;
      g:= 5*n;
      b:= 8*n;
      if r mod k <> 0 then r:= r div k +1
      else r:= r div k;
      if g mod k <> 0 then g:= g div k +1
      else g:= g div k;
      if b mod k <> 0 then b:= b div k +1
      else b:= b div k;
      writeln (r+g+b);
END.

var n,k,redneed,greenneed,blueneed:int64;
begin
        readln(n,k);
        redneed:=n*2;
        if (redneed mod k)<>0 then redneed:=(redneed div k)+1
        else redneed:=redneed div k;
        greenneed:=n*5;
        if (greenneed mod k)<>0 then greenneed:=(greenneed div k)+1
        else greenneed:=greenneed div k;
        blueneed:=n*8;
        if (blueneed mod k)<>0 then blueneed:=(blueneed div k)+1
        else blueneed:=blueneed div k;
        write(redneed+greenneed+blueneed);
end.

var n,k,count:int64;
begin
   readln(n,k);
   count:=(n*2-1)div k+1;
   count:=count+ (n*5-1)div k+1;
   count:=count+ (n*8-1)div k+1;
   writeln(count);
end.

var n,k:longint;
red,blue,green:longint;
n1,n2,n3:longint;
begin
 read(n,k);
 red:=n*2;
 green:=n*5;
 blue:=n*8;

 if red mod k<>0 then
  begin
   n1:=red div k+1;
  end
 else
  begin
   n1:=red div k;
  end;

 if green mod k<>0 then
  begin
   n2:=green div k+1;
  end
 else
  begin
   n2:=green div k;
  end;

 if blue mod k<>0 then
  begin
   n3:=blue div k+1;
  end
 else
  begin
   n3:=blue div k;
  end;

 writeln(n1+n2+n3);
readln();
end.

var n,k,m,kr,z,s:integer;
begin
     readln(n,k);
     kr:=2*n;
     z:=5*n;
     s:=8*n;
     if kr mod k = 0 then
        kr:=kr div k
     else
         kr:=(kr div k) + 1;
     if z mod k = 0 then
        z:=z div k
     else
         z:=(z div k) + 1;
     if s mod k = 0 then
        s:=s div k
     else
         s:=(s div k) + 1;
     m:=kr+s+z;
     writeln(m);
end.

Program A542;
Var n,k,a,b,c,d,e,f:longint;

BEGIN
    readln(n,k);
    a := 2 * n; b := 5 * n; c := 8 * n;

    if a mod k = 0 then d := a div k else d := a div k + 1;
    if b mod k = 0 then e := b div k else e := b div k + 1;
    if c mod k = 0 then f := c div k else f := c div k + 1;

    writeln(d + e + f);
END.

Program NKUB1;
  Var
      r, g, b, s, k, n: longint;
 Begin
  Readln(n, k);
  if (2 * n) mod k <> 0 then r := (2 * n) div k + 1
   else r := (2 * n) div k;
  if (5 * n) mod k <> 0 then g := (5 * n) div k + 1
   else g := (5 * n) div k;
  if (8 * n) mod k <> 0 then b := (8 * n) div k + 1
   else b := (8 * n) div k;
  s := r + g + b;
  Writeln(s);
  Readln;
 End.

const
        Bool: array [FALSE..TRUE] of LongInt = (0, 1);

var
        n, k, r, g, b, s: LongInt;

begin
        ReadLn (n, k);

        r := 2;
        g := 5;
        b := 8;

        s := (n * r) div k + Bool[(n * r) mod k <> 0];
        s := s + (n * g) div k + Bool[(n * g) mod k <> 0];
        s := s + (n * b) div k + Bool[(n * b) mod k <> 0];

        WriteLn (s);
end.

const fi='';
      fo='';
Var a,b,c,n,kq,k: longint;
    f,g: text;
Begin
    Assign(f,fi);
    Assign(g,fo);
    Reset(f);
    Rewrite(g);
    Readln(f,n,k);
    a:=n*2;
    b:=n*5;
    c:=n*8;
    kq:= a div k + b div k + c div k;
    If a mod k <>0 then
        inc(kq);
    If b mod k <>0 then
        inc(kq);
    If c mod k <>0 then
        inc(kq);
    Writeln(g,kq);
    Close(f);
    Close(g);
End.

Var n , k , r , g , b : Longint;
    kq : Int64;
Begin
Readln(n , k);
If n * 2 mod k = 0 then r := n * 2 div k else r := n * 2 div k + 1;
If n * 5 mod k = 0 then g := n * 5 div k else g := n * 5 div k + 1;
If n * 8 mod k = 0 then b := n * 8 div k else b := n * 8 div k + 1;
kq := r + g + b;
Writeln(kq);
End.

var
 n,k,x,y,z,ans:longint;
begin
 readln(n,k);
 x:=2*n;y:=5*n;z:=8*n;
 if x mod k=0 then ans:=x div k
              else ans:=x div k+1;
 if y mod k=0 then ans:=ans+y div k
              else ans:=ans+y div k+1;
 if z mod k=0 then ans:=ans+z div k
              else ans:=ans+z div k+1;
 writeln(ans);
end.

var
 n,list,kol,r1,r2,r3,r4,sum,m:longint;
begin
read(n,kol);
r1:=n*2;
r2:=n*5;
r3:=n*8;
r4:=r1+r2+r3;
while sum<=r4 do
 begin
  inc(sum,kol);
  inc(m);
 end;
writeln(m);
end.

var
  d, c, i, n, a, k, b: integer;

begin
  a := 1;
  c := 1;
  d := 1;
  readln(n, k);

  repeat
    if k * a >= 2 * n then//12 и 4
    begin
      b := b + a;
      break;
    end

    else
      a := a + 1;//2

  until 0 = 1;

  repeat
    if k * c >= 2 * n then//12 и 4
    begin
      b := b + c;
      break;
    end

    else
      c := c + 1;//2

  until 0 = 1;

  repeat
    if k * d >= 2 * n then//12 и 4
    begin
      b := b + d;
      break;
    end

    else
      d := d + 1;//2

  until 0 = 1;

  writeln(b);

end.

program pr1;
var n,k,s,r,b,g:integer;
begin
readln(n,k);
if n*2 mod k=0 then r:=n*2 div k
else r:=((n*2) div k)+1;
if n*5 mod k=0 then g:=n*5 div k
else g:=((n*5) div k)+1;
if n*8 mod k=0 then b:=k*8 div k
else b:=((n*8) div k)+1;
s:=b+r+g;
writelN(s);
end.

program pr1;
var
i,k,g,n,a,b,c:integer;
begin
read(n,g);
a:=n*2;
b:=n*5;
c:=n*8;k:=0;
for i:=1 to 1000000 do begin
if a>0 then begin a:=a-g;k:=k+1;end;
if b>0 then begin b:=b-g;k:=k+1;end;
if c>0 then begin c:=c-g;k:=k+1;end;
end;
writeln(k);
end.

program pr1;
var
i,k,g,n,a,b,c:integer;
begin
read(n,g);
a:=n*2;
b:=n*5;
c:=n*8;k:=0;
for i:=1 to n*g do begin
if a>0 then begin a:=a-g;k:=k+1;end;
if b>0 then begin b:=b-g;k:=k+1;end;
if c>0 then begin c:=c-g;k:=k+1;end;
end;
writeln(k);
end.

program pr1;
var
i,k,g,n,a,b,c:integer;
begin
read(n,g);
a:=n*2;
b:=n*5;
c:=n*8;k:=0;
while c>0 do begin
if a>0 then begin a:=a-g;k:=k+1;end;
if b>0 then begin b:=b-g;k:=k+1;end;
c:=c-g;k:=k+1;
writelN(c);
end;
writeln(k);
end.

program n_1;
var n,k: integer;
B1,B2,B3: integer;
kol:integer;
begin
readln (n,k);
b1:=round (2*n/k);
b2:=round (5*n/k);
b3:=round (8*n/k);
kol:=b1+b2+b3;
writeln (kol+1);
end.

program n_1;
var n,k: integer;
B1,B2,B3: integer;
kol:integer;
begin
readln (n,k);
b1:=round (2*n/k);
b2:=round (5*n/k);
b3:=round (8*n/k);
kol:=b1+b2+b3;
writeln (kol);
end.

program a1;
var n,k : longint;
r,g,b: shortint;
Begin
readln(n,k);
r:=n*2;
g:=n*5;
b:=n*8;
if r mod k<>0 then
r:=(r div k)+1
else r:=r div k;
if g mod k<>0 then
g:=(g div k)+1
else g:=g div k;
if b mod k<>0 then
b:=(b div k)+1
else b:=b div k;
writeln(r+g+b);
End.

program a1;
var n,k : longint;
r,g,b: shortint;
Begin
readln(n,k);
r:=n*2;
g:=n*5;
b:=n*8;
if r mod k<>0 then
r:=(r mod k)+1
else r:=r div k;
if g mod k<>0 then
g:=(g mod k)+1
else g:=g div k;
if b mod k<>0 then
b:=(b mod k)+1
else b:=b div k;
writeln(r+g+b);
End.

var a,b,c:integer;
begin
readln (a,b);
writeln (10);
end.

var n, k, m, rmin, gmin, bmin, rbl, gbl, bbl:integer;
begin
 readln(n, k);
 rmin:=n*2;
 gmin:=n*5;
 bmin:=n*8;
 rbl:=rmin div k;
 if rmin mod k <> 0 then inc(rbl);
 writeln(rbl);
 gbl:=gmin div k;
 if gmin mod k <> 0 then inc(gbl);
 writeln(gbl);
 bbl:=bmin div k;
 if bmin mod k <> 0 then inc(bbl);
 writeln(bbl);
 m:=rbl+gbl+bbl;
 writeln(m);
end.