Under construction

Still being built. Things may change

A Hero Named Magnus

Time limit1sMemory limit1024 MB

Summary
Given the game x where Team LGD starts banning Magnus, find the minimum odd best-of-n series length that lets LGD win the championship in the worst case.
Level

Medium7 of 10

Topics
Math, Probability
Solved
No attempts yet

Statement

Dota 2 is a multiplayer online battle arena (MOBA) video game developed and published by Valve. Dota 2 is played in matches between two teams of five players, with each team occupying and defending their own separate base on the map. Each of the ten players independently controls a powerful character, known as a 'hero', who all have unique abilities and differing styles of play. During a match, players collect experience points and items for their heroes to defeat the opposing team's heroes in player versus player combat. A team wins by being the first to destroy the other team's 'Ancient', a large structure located within their base.

The International is an annual esports world championship tournament for the video game Dota 2, hosted and produced by the game's developer, Valve. The tournament consists of 1818 teams: 12 based on final results from the Dota Pro Circuit and six more from winning regional playoffs in the North America, South America, Southeast Asia, China, Eastern Europe, and Western Europe regions.

In Year 3021, The International is held in Guilin, China. Once again, just like 10001000 years ago, Team LGD from China will compete against Team Spirit from Russia. As the championship develops, the rule is that whoever wins the best of nn games wins the championship, where nn is an odd positive integer. So a team must win at least n+12\frac{n+1}{2} games. In 2021, nn was only 55, and Team Spirit won 3:23:2.

Before the game starts, teams can choose to ban specific heroes from being used by the opponent team. Over these 10001000 years, everyone has known that Team Spirit is very good at using a hero called Magnus, which once helped them defeat Team LGD in 20212021.

Everyone thinks Team LGD will choose to ban Magnus from the beginning, but Team LGD thinks differently. They believe they are strong enough to beat the opponent's Magnus, so they will only start to ban Magnus in the xx-th game, and only if there is an xx-th game.

To simplify the problem, if Team LGD chooses to ban Magnus, they will certainly win that game. Otherwise, they have a 50%50\% chance to win the game.

JB, a fan of Team LGD, wants to know the minimum number of nn with which Team LGD can win the championship in the worst case.

Input

The first line contains an integer TT (1≤T≤1051 \leq T \leq 10^5), the number of test cases.

Each of the next TT lines contains an integer xx (1≤x≤2×1091 \leq x \leq 2 \times 10^9), indicating that Team LGD will start to ban Magnus in the xx-th game.

Output

For each test case, output an integer on one line, the minimum total number of games needed for Team LGD to win.

Hint

Ignoring everyone's strongest wish, there exists x>1x>1 in the test data, which means Team LGD will not always choose to ban Magnus from the beginning.

Examples1

  1. Example 1

    Input
    2
    1
    3
    
    Expected output
    1
    5