Problem Description
輕松通過墓碑,進入古墓後,才發現裡面别有洞天。
突然,Yifenfei發現自己周圍是黑壓壓的一群蝙蝠,個個扇動翅膀正準備一起向他發起進攻!
形勢十分危急!
好在此時的yifenfei已經不是以前那個經常被lemon搶走MM的菜鳥了!面對衆多蝙蝠的嗜血狂攻,隻見yifenfei使出輕靈的劍法,刷,刷,刷,瞬間搞定……
現已知yifenfei使用了2招(劍招A和劍招B):劍招A,一招能殺死一半的蝙蝠。但是如果目前的蝙蝠數為奇數,那麼就必須先出一招劍招B殺死其中任意一個,使蝙蝠數為偶數,再出劍招A。
現在請問:殺死n隻蝙蝠需要使出多少招劍招B?

Input
輸入資料首先給出一個整數C,表示測試組數。
然後是C組資料,每組包含一個正整數n (n<2^31)。
Output
對應每組資料,請輸出一個整數,表示yifenfei使用的劍招B的數目,每組輸出占一行。
Sample Input
2
1
5
Sample Output
1
2
#include <iostream>
int main(int argc, const char* argv[])
{
int nCases = 0;
std::cin >> nCases;
while (nCases--)
{
int nCount = 0;
int nBat = 0;
std::cin >> nBat;
while (nBat != 0)
{
if (nBat%2 == 0)
{
nBat /= 2;
}
else
{
++nCount;
nBat -= 1;
}
}
std::cout << nCount << std::endl;
}
return 0;
}