import kotlin.math.*

typealias Num=Int

fun binarySearch(ok:Num,ng:Num,eps:Num,f:(Num)->Boolean):Num {
	var _ok = ok
	var _ng = ng
	while(abs(_ok-_ng)>eps) {
		val mid = (_ok+_ng)/2
		if(f(mid))
			_ok = mid
		else
			_ng = mid
	}
	return _ok
}

fun main() {
	for(n in 1..readLine()!!.toInt()) {
		var r = 0L
		for(x in 1..n) {
			val m = n-x*x
			if(m<2*x+3)
				break

			for(y in x..m) {
				val o = m-y*y-x*y
				if(o<x+y+1)
					break

				val z = binarySearch(y,o,1) {z-> z*z+x*z+y*z<=o}
				if(z*z+x*z+y*z==o) {
					when {
						x==y&&y==z->++r
						x==y||y==z||z==x->r += 3
						else->r += 6
					}
				}
			}
		}
		println(r)
	}
}
