n people came to a party. Then those, who had no friends among people at the party, left. Then those, who had exactly 1 friend among those who stayed, left as well. Then those, who had exactly 2, 3, ..., n - 1 friends among those who stayed by the moment of their leaving, did the same.

What is the maximum amount of people that could stay at the party in the end? 

Input

The first input line contains one number t — amount of tests (1 ≤ t ≤ 105). Each of the following t lines contains one integer number n (1 ≤ n ≤ 105).

Output

For each test output in a separate line one number — the maximum amount of people that could stay in the end.

Examples

Input

1
3


Output

1
/* IMPORTANT: Multiple classes and nested static classes are supported */
 
/*
 * uncomment this if you want to read input.
import java.io.BufferedReader;
import java.io.InputStreamReader;
*/
import java.util.*;
import java.io.*;
public class Main {
private static InputStream stream;
private static byte[] buf=new byte[1024];
private static int curChar;
private static int numChars;
private static PrintWriter pw;
static long min=Long.MAX_VALUE;
private static SpaceCharFilter filter;
    public static void main(String args[] ) throws Exception 
    {
    	InputReader(System.in);
    	pw=new PrintWriter(System.out);
    	soln();
    	pw.close();
    }
    public static void soln()
    {
	int t=nextInt();
	for(int i=0;i<t;i++)
	{
		int n=nextInt();
		if(n>=3)
		System.out.println(n-2);
		else
			System.out.println(0);
	}
}
public static void InputReader(InputStream stream1) {
	stream = stream1;
}
 
private static boolean isWhitespace(int c) {
	return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
}
 
private static boolean isEndOfLine(int c) {
	return c == '\n' || c == '\r' || c == -1;
}
 
private static 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++];
}
 
private static int nextInt() {
	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;
}
 
private static long nextLong() {
	int c = read();
	while (isSpaceChar(c))
		c = read();
	int sgn = 1;
	if (c == '-') {
		sgn = -1;
		c = read();
	}
	long res = 0;
	do {
		if (c < '0' || c > '9')
			throw new InputMismatchException();
		res *= 10;
		res += c - '0';
		c = read();
	} while (!isSpaceChar(c));
	return res * sgn;
}
 
private static String nextToken() {
	int c = read();
	while (isSpaceChar(c))
		c = read();
	StringBuilder res = new StringBuilder();
	do {
		res.appendCodePoint(c);
		c = read();
	} while (!isSpaceChar(c));
	return res.toString();
}
 
private static String nextLine() {
	int c = read();
	while (isSpaceChar(c))
		c = read();
	StringBuilder res = new StringBuilder();
	do {
		res.appendCodePoint(c);
		c = read();
	} while (!isEndOfLine(c));
	return res.toString();
}
 
private static int[] nextIntArray(int n) {
	int[] arr = new int[n];
	for (int i = 0; i < n; i++) {
		arr[i] = nextInt();
	}
	return arr;
}
  
private static long[] nextLongArray(int n) {
	long[] arr = new long[n];
	for (int i = 0; i < n; i++) {
		arr[i] = nextLong();
	}
	return arr;
}
 
private static void pArray(int[] arr){
	for (int i=0; i<arr.length; i++) {
		System.out.print(arr[i] + " ");
	}
	System.out.println();
	return;
}
 
private static void pArray(long[] arr){
	for (int i=0; i<arr.length; i++) {
		System.out.print(arr[i] + " ");
	}
	System.out.println();
	return;		
}
 
private static boolean isSpaceChar(int c) {
	if (filter != null)
		return filter.isSpaceChar(c);
	return isWhitespace(c);
}
 
private interface SpaceCharFilter {
	public boolean isSpaceChar(int ch);
}
 
}