program xyz_triplets
  implicit none
  integer :: n, f(10000) = 0, i, x, y, z, sx, sy, sz
  read(*,*) n
  do x = 1, n
    sx = x * x
    if (sx > n) exit
    do y = 1, n
      sy = sx + y * y + x * y
      if (sy > n) exit
      do z = 1, n
        sz = sy + z * z + y * z + z * x
        if (sz > n) exit
        f(sz) = f(sz) + 1
      end do
    end do
  end do
  write(*,'(i0)') (f(i), i = 1, n)
end program xyz_triplets