Given a number **N**, and an infinite supply of **Complete Binary Trees** of various depths. Your task is to pick minimum number of binary trees such that sum of total number of leaf node of each tree you have picked is **N**.

**Note:** For binary tree with only root node: Depth=1, Leaf nodes=1

**Input:**

First line of input consist of a single integer T denoting the total number of test case. Then T test cases follow. Each line of test case contains a single integer N,as described in the problem statement.

**Output:**

For each test case, print a single line containing the minimum number of trees you need to pick.

**Constraints:**

1<=T<=100

1<=N<=10^9

**Example:**

**Input:**

2

1

5

**Output:**

1

2

**Explanation:**

1. For the first test one binary tree is sufficient.

2. For the second test case pick 2 binary trees of depth 1 and 3 .

Author: pra1nay7_313

If you have purchased any course from GeeksforGeeks then please ask your doubt on course discussion forum. You will get quick replies from GFG Moderators there.

sabka_din_aayega | 317 |

maggiiiii | 248 |

thanuvinu94 | 211 |

Savage_19 | 206 |

Anugrah_kumar | 172 |

Bishnu Dev Panda | 803 |

sabka_din_aayega | 628 |

Anugrah_kumar | 562 |

okayboss | 561 |

maggiiiii | 531 |

blackshadows | 5331 |

Ibrahim Nash | 5219 |

akhayrutdinov | 5111 |

mb1973 | 4925 |

Quandray | 4547 |

Login to report an issue on this page.