#include using namespace std; using ll = long long; using pll = pair; #define drep(i, cc, n) for (ll i = (cc); i <= (n); ++i) #define rep(i, n) drep(i, 0, n - 1) #define all(a) (a).begin(), (a).end() #define pb push_back #define fi first #define se second const ll MOD = 1000000007; const ll MOD2 = 998244353; const ll INF = 1LL << 60; const ll N_MAX = 2e5; map mp; void dfs(ll x){ if(mp.find(x) != mp.end()) return; ll cnt = 1; ll y = x; for(ll i=2; i*i<=x; i++){ if(y%i != 0) continue; ll c = 0; while(y%i == 0){ y/=i; c++; } cnt *= (c+1); } if(y != 1) cnt*=2; dfs(x - cnt); mp[x] = mp[x-cnt]; return; } int main(){ ll t; cin >> t; vector a(t); rep(i, t){ cin >> a[i].fi; a[i].se = i; } sort(all(a)); mp[1] = 1; mp[2] = 2; vector ans(t); rep(i, t){ dfs(a[i].fi); ans[a[i].se] = mp[a[i].fi]; } rep(i, t) cout << ans[i] << endl; }