program abc9
 implicit none
 integer::N,i,x,y,z,s
 read(*,*)N
 do i=1,N
  do x=1,N
   do y=1,N
    do z=1,N
     if(x**2+y**2+z**2+x*y+y*z+z*x==i)then
      s=s+1
     end if
    end do
   end do
  end do
  print'(i0)',s
 end do
end program abc9