/*
**    author : dhiraj govindvira
**      date : 21-Nov-2020 ~ Saturday
**      time : 08:07:06 PM
*/

#include <bits/stdc++.h>
using namespace std;

#ifdef Dhiraj
    #include "D:/dhiraj/Programming/debug.h"
#else
    #define d(...) 11
    #define cerr if(0) cerr
#endif

#define ll        long long int
#define all(x)    (x).begin(), (x).end()
#define rall(x)   (x).rbegin(), (x).rend()
#define endl      '\n'

template <typename T, typename U>
inline istream& operator >> (istream& in, pair<T, U>& a) {
    in >> a.first >> a.second;
    return in;
}
template <typename T>
inline istream& operator >> (istream& in, vector<T>& a) {
    for(auto& x : a) in >> x;
    return in;
}

void solve(int &T)
{
    ll n;
    cin >> n;

    if(n == 1) {
        cout << 0 << endl;
    }
    else if(n == 2) {
        cout << 1 << endl;
    }
    else if(n == 3) {
        cout << 2 << endl;
    }
    else
    {
        ll ans = 0;
        if(n & 1) {
            ans++;
        }
        ans += 2;
        cout << ans << endl;
    }
}

int main()
{
    #ifdef Dhiraj
        freopen("D:/dhiraj/Programming/i1.txt", "r", stdin);
        freopen("D:/dhiraj/Programming/o1.txt", "w", stdout);
        // freopen("D:/dhiraj/Programming/e1.txt", "w", stderr);
    #endif

    ios::sync_with_stdio(false);
    cin.tie(0);

    int tc = 1;
    cin >> tc;
    for(int i = 1; i <= tc; i++) {
        cerr << "Case #" << i << "\n";
        solve(i);
    }
    return 0;
}