let calc x y z = x * x + y * y + z * z + x * y + y * z + z * x

let count (x, y, z) = 
  if x = y && x = z then 
    1
  else if x <> y && y <> z && z <> x then
    6
  else 
    3

let rec findUpper x num =
  if x * (x + 2) < num then
     findUpper (x + 1) num
  else
    x

let solve num =
  let upper = findUpper 1 num
  [
    for x in 1 .. upper do
      for y in 1 .. x do
        for z in 1 .. y -> (x, y, z)
  ] 
  |> List.filter (fun (x, y ,z) -> calc x y z = num)
  |> List.sumBy count


let n = stdin.ReadLine() |> int

[1 .. n]
|> List.map (fun x -> x |> solve |> (printfn "%d"))