#include <bits/stdc++.h>
#define FOR(i,a,b) for(long long i=a;i<=b;i++)
#define st first
#define nd second
#define checkbit(i,x) (((x)>>(i))&1)
#define ALL(a) (a).begin(), (a).end()
using namespace std;
const long long MOD = 1e9 + 7;
const int maxn = 1e3 + 5;
const long long INF = 1e18;
int n, m, q;
bool check ( int x ) {
    long long s = 0;
    int cnt_c = 0;
    int cnt_l = 0;
    for ( int i = 1; i <= x; i++ ) {
        if ( x % i == 0 ) {
            s += i;
            if ( i % 2 != 0 ) cnt_l++;
            else cnt_c++;
        }
    }
    if ( s % 2 != 0 && cnt_c == cnt_l ) return true;
    else return false;
}
namespace sub12 {
void solve ( long long x ) {
    long long cnt = 0;
    for ( int i = 1; i <= x; i++ ) {
        if ( x % i == 0 && check ( i ) ){
            ++cnt;
        }
    }
    cout << cnt << "\n";
}
}
namespace sub3 {
void solve ( long long x ) {
    if ( x % 2 != 0 ) {
        cout << 0 << "\n";
        return;
    }
    long long cnt = 0;
    for ( long long i = 1; i * i <= x; i++ ) {
        if ( x % ( 2 * i * i ) == 0 && ( i * i ) % 2 != 0  ){
            ++cnt;
        }
    }
    cout << cnt << "\n";
}
}
void solve() {
    cin >> q;
    while ( q-- ) {
        long long x;
        cin >> x;
        if ( x <= 1e6 ) sub12::solve ( x );
        else if ( x > 1e6 && x <= 1e12 ) sub3::solve ( x );
        else if ( x > 1e12 && x <= 1e18 ) {
            long long k2 = 0;
            while ( x % 2 == 0 ) {
                k2++;
                x /= 2;
            }
            if ( k2 == 0 ) {
                cout << 0 << "\n";
                continue;
            }
            long long ans = 1;
            for ( long long i = 3; i * i <= x; i += 2 ) {
                if ( x % i == 0 ) {
                    long long ki = 0;
                    while ( x % i == 0 ) {
                        ki++;
                        x /= i;
                    }
                    ans *= ( ki / 2 + 1 );
                }
            }
            cout << ans << "\n";
        }
    }
}
int main() {
    freopen ( "test.inp", "r", stdin );
    freopen ( "test.out", "w", stdout );
    ios_base::sync_with_stdio ( false );
    cin.tie ( NULL );
    solve();
    return 0;
}
