import java.io.BufferedReader import java.io.InputStream import java.io.InputStreamReader import java.io.PrintWriter import java.util.* import java.math.BigInteger fun PrintWriter.solve(sc: FastScanner) { val t = sc.nextInt() for (_i in 0 until t) { val n = sc.nextInt() println(f(n - 1)) } } fun f(n: Int): Int { var s = 0 var m = 1 var N = 2 * n + 1 while (true) { val k = N + m var x = k var v = 0 while (x % 2 == 0) { x /= 2 v++ } s += v m = k shr v if (m == 1) break } return s } fun main() { val writer = PrintWriter(System.out, !false) writer.solve(FastScanner(System.`in`)) writer.flush() } class FastScanner(s: InputStream) { private var st = StringTokenizer("") private val br = BufferedReader(InputStreamReader(s)) fun next(): String { while (!st.hasMoreTokens()) st = StringTokenizer(br.readLine()) return st.nextToken() } fun nextInt() = next().toInt() fun nextLong() = next().toLong() fun nextLine() = br.readLine() fun nextDouble() = next().toDouble() fun ready() = br.ready() }