#include <iostream>
#define ll long long
#define endl '\n'
#define st first
#define nd second
#define pb push_back
using namespace std;
void solve()
{
    ll n;
    cin>>n;
    ll ans=0;
    while(n>1)
    {
        if(n==2)
        {
            ans++;
            n--;
        }
       else  if(n%2==1)
        {
            ans++;
            n--;
        }
        else
        {
            ans++;
            n/=(n/2);
        }
    }
    cout<<ans<<endl;
}
int main()
{
    int t;
    cin>>t;
    while(t--)
    {
        solve();
    }
    return 0;
}
