import scala.util.control.Breaks

object Main extends App {
  val n = scala.io.StdIn.readInt()
  var fMap = scala.collection.mutable.Map.empty[Int, Vector[Int]]

  def caluc(x: Int, y: Int, z: Int) = {
    x * x + y * y + z * z + x * y + y * z + x * z
  }

  def loopVariableZ(x: Int, y: Int, z: Int) = {
    val b = new Breaks
    var i = z
    b.breakable {
      while (true) {
        val calucRes = caluc(x, y, i)
        if (calucRes > n) {
          b.break()
        } else {
          fMap.put(calucRes, Vector(x, y, i))
        }
        i = i + 1
      }
    }
  }

  def loopVariableY(x: Int, y: Int, z: Int) = {
    val b = new Breaks
    var i = y
    b.breakable {
      while (true) {
        val calucRes = caluc(x, i, z)
        if (calucRes > n) {
          b.break()
        } else {
          fMap.put(calucRes, Vector(x, i, z))
        }
        i = i + 1
        loopVariableZ(x, i, z)
      }
    }
  }

  def loopVariableX(x: Int, y: Int, z: Int) = {
    val b = new Breaks
    var i = x
    b.breakable {
      while (true) {
        val calucRes = caluc(i, y, z)
        if (calucRes > n) {
          b.break()
        } else {
          fMap.put(calucRes, Vector(i, y, z))
        }
        i = i + 1
        loopVariableY(i, y, z)
      }

    }
  }

  loopVariableX(1, 1, 1)
  (1 to n).foreach { i =>
    val combVecOpt = fMap.get(i)
    if (combVecOpt.isDefined) {
      val combVec = combVecOpt.get
      if (combVec(0) == combVec(1) && combVec(0) == combVec(2) && combVec(1) == combVec(2)) {
        println(1)
      } else if (combVec(0) != combVec(1) && combVec(0) != combVec(2) && combVec(1) != combVec(2)) {
        println(6)
      } else {
        println(3)
      }
    } else {
      println(0)
    }
  }
}