program q_3
  implicit none
  integer(8) :: n,i,ans

  read(*,*) n
  do i =1,n
     call cal(i,ans)
     write(*,*) ans
  enddo

contains

  subroutine cal(n,ans)
    implicit none
    integer(8) :: n,i,ans,maxy,maxz,x,y,z

    if(n<=5)then
       ans=0
    elseif(n==6)then
       ans=1
    else
       ans=0
       do x = 1,int(sqrt(dble(n-2))-1)
          maxy=int(dble(-(x+1)+sqrt(dble((x+1)**2-4*(x**2+x+1-n))))/2.0d0)
          do y = 1,int(maxy)
             maxz=int(dble(-(x+y)+sqrt(dble((x+y)**2-4*(x**2+x*y+y**2-n))))/2.0d0)
             do z = 1,int(maxz)
                if ((x+y+z)**2 == n+(x*y + y*z + z*x)) then
                   ans = ans + 1
                end if
             end do
          end do
       end do
    end if
  end subroutine cal

end program q_3