      program a159
      integer N

      integer s,i,j,k,cnt,unk
    
      read(*,*)N


      do s =1, N
            cnt = 0
      do i =1, N
        if (i * i + i .gt. N)then
            exit
        endif
      do j =1, N
            if (j * j + j + i * i + i .gt. N)then
                exit
            endif
      do k =1, N
                if (k * k + k + j * j + j + i * i + i .gt. N)then
                   exit
                endif
                unk =i*i + j*j + k*k + i*j + j*k + k*i
                if (unk == s)then
                    cnt = cnt+1
                    exit      
                else if (unk .gt. s)then
                    exit
                endif

     
            enddo
            enddo
            enddo
             write(*,*)cnt
            enddo

      end program a159