Ridbit starts with an integer n.

In one move, he can perform one of the following operations: 

  * divide n by one of its proper divisors, or 
  * subtract 1 from n if n is greater than 1. 



A proper divisor is a divisor of a number, excluding itself. For example, 1, 2, 4, 5, and 10 are proper divisors of 20, but 20 itself is not.

What is the minimum number of moves Ridbit is required to make to reduce n to 1?

Input

The first line contains a single integer t (1 ≤ t ≤ 1000) — the number of test cases.

The only line of each test case contains a single integer n (1 ≤ n ≤ 10^9).

Output

For each test case, output the minimum number of moves required to reduce n to 1.

Example

Input


6
1
2
3
4
6
9


Output


0
1
2
2
2
3

Note

For the test cases in the example, n may be reduced to 1 using the following operations in sequence

1

2 \xrightarrow{} 1

3 \xrightarrow{} 2 \xrightarrow{} 1

4 \xrightarrow{} 2 \xrightarrow{} 1

6 \xrightarrow{} 2 \xrightarrow{} 1

9 \xrightarrow{} 3 \xrightarrow{} 2\xrightarrow{} 1

import java.lang.reflect.Array;
import java.util.*;
import java.util.function.Function;
import java.util.stream.Collectors;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Random;
import java.util.StringTokenizer;
import java.io.*;
import java.math.*;

public class CC
{
    static class pair implements Comparable<pair>
    {
        int x;
        long y;
        pair(int x,long y)
        {
            this.x=x;
            this.y=y;
        }
        public int compareTo(pair o)
        {
            return (int)(y-o.y);
        }

    }
    static ArrayList<Long>num=new ArrayList<>();
    static void printPermutn(String str, String ans)
    {

        // If string is empty
        if (str.length() == 0) {
            num.add(Long.valueOf(ans));
            return;
        }

        for (int i = 0; i < str.length(); i++)
        {

            // ith character of str
            char ch = str.charAt(i);

            // Rest of the string after excluding
            // the ith character
            String ros = str.substring(0, i) +
                    str.substring(i + 1);

            // Recurvise call
            printPermutn(ros, ans + ch);
        }
    }

    public static void main(String[] args)
    {
        StringBuffer sb = new StringBuffer();

        int t=i();
        while (t-->0)
        {
        long n=l();
        long num=0;
        long number=n;
       if(n==1)
       {
           num=0;
       }
      else if(n==2)
       {
           num=num+1;
       }
           else if(n==3)
            {
                num=num+2;
            }
           else {
               if(n%2==0)
               {
                num+=2;
               }else {
                   num+=3;
               }
       }
       sb.append(num+"\n");













       }



        System.out.println(sb.toString());
    }


 //********************************Class pair******************************************************************************************************************************************///////////////////////////////////////////////////////////////////////////////////////////////

//-------------------prime factorization********/***************************************************************************************************************************************///////////////////////////////////
static TreeMap primefactorize(long n)
{
    TreeMap<Integer,Integer>h=new TreeMap<>();
    long number=n;
    for(int i=2;i<=Math.sqrt(n);i++)
    {
        if(n%i==0)
        {
            int cnt=0;
            while(n%i==0)
            {
                n=n/i;
                cnt++;
            }
            h.put(i,cnt);
        }
    }
    if(n!=1)
        h.put((int)n,1);
    return h;
}
///******************************SYSTEM PART*****************************************************************************************************************************************************************************************************************************************************////
    static InputReader in=new InputReader(System.in);
    static OutputWriter out=new OutputWriter(System.out);

    public static long pow(long a, long b)
    {
        long result=1;
        while(b>0){
            if (b % 2 != 0){
                result=(result*a);
                b--;
            }
            a=(a*a);
            b /= 2;
        }
        return result;
    }
    public static long gcd(long a, long b){
        if (a == 0){
            return b;
        }
        return gcd(b%a, a);
    }
    public static long lcm(long a, long b){
        return a*(b/gcd(a,b));
    }
    public static long l(){
        String s=in.String();
        return Long.parseLong(s);
    }
    public static void pln(String value){
        System.out.println(value);
    }
    public static int i(){
        return in.Int();
    }
    public static String s(){
        return in.String();
    }
}
///******************input Reader//***************************************************************************************************************************************************************************************
class InputReader
{
    private InputStream stream;
    private byte[] buf = new byte[1024];
    private int curChar;
    private int numChars;
    private SpaceCharFilter filter;
    public InputReader(InputStream stream) {
        this.stream = stream;
    }
    public int read() {
        if (numChars== -1)
            throw new InputMismatchException();
        if (curChar >= numChars) {
            curChar = 0;
            try {
                numChars = stream.read(buf);
            } catch (IOException e) {
                throw new InputMismatchException();
            }
            if (numChars <= 0)
                return -1;
        }
        return buf[curChar++];
    }
    public int Int() {
        int c = read();
        while (isSpaceChar(c))
            c = read();
        int sgn = 1;
        if (c == '-') {
            sgn = -1;
            c = read();
        }
        int res = 0;
        do {
            if (c < '0' || c > '9')
                throw new InputMismatchException();
            res *= 10;
            res += c - '0';
            c = read();
        } while (!isSpaceChar(c));
        return res * sgn;
    }
    public String String() {
        int c = read();
        while (isSpaceChar(c))
            c = read();
        StringBuilder res = new StringBuilder();
        do {
            res.appendCodePoint(c);
            c = read();
        } while (!isSpaceChar(c));
        return res.toString();
    }
    public boolean isSpaceChar(int c) {
        if (filter != null)
            return filter.isSpaceChar(c);
        return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
    }
    public String next() {
        return String();
    }
    public interface SpaceCharFilter
    {
        public boolean isSpaceChar(int ch);
    }
}

//*******************OUTPUT WRITER********************************************************************************************************************************************************************************************************************************************************//
class OutputWriter {
    private final PrintWriter writer;
    public OutputWriter(OutputStream outputStream) {
        writer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(outputStream)));
    }
    public OutputWriter(Writer writer) {
        this.writer = new PrintWriter(writer);
    }
    public void print(Object...objects) {
        for (int i = 0; i < objects.length; i++) {
            if (i != 0)
                writer.print(' ');
            writer.print(objects[i]);
        }
    }
    public void printLine(Object...objects) {
        print(objects);
        writer.println();
    }
    public void close() {
        writer.close();
    }
    public void flush() {
        writer.flush();
    }
}







