n people gathered to hold a jury meeting of the upcoming competition, the i-th member of the jury came up with a_i tasks, which they want to share with each other.

First, the jury decides on the order which they will follow while describing the tasks. Let that be a permutation p of numbers from 1 to n (an array of size n where each integer from 1 to n occurs exactly once).

Then the discussion goes as follows:

  * If a jury member p_1 has some tasks left to tell, then they tell one task to others. Otherwise, they are skipped. 
  * If a jury member p_2 has some tasks left to tell, then they tell one task to others. Otherwise, they are skipped. 
  * ... 
  * If a jury member p_n has some tasks left to tell, then they tell one task to others. Otherwise, they are skipped. 
  * If there are still members with tasks left, then the process repeats from the start. Otherwise, the discussion ends. 



A permutation p is nice if none of the jury members tell two or more of their own tasks in a row. 

Count the number of nice permutations. The answer may be really large, so print it modulo 998 244 353.

Input

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

The first line of the test case contains a single integer n (2 ≤ n ≤ 2 ⋅ 10^5) — number of jury members.

The second line contains n integers a_1, a_2, ..., a_n (1 ≤ a_i ≤ 10^9) — the number of problems that the i-th member of the jury came up with.

The sum of n over all test cases does not exceed 2 ⋅ 10^5.

Output

For each test case, print one integer — the number of nice permutations, taken modulo 998 244 353.

Example

Input


4
2
1 2
3
5 5 5
4
1 3 3 7
6
3 4 2 1 3 3


Output


1
6
0
540

Note

Explanation of the first test case from the example:

There are two possible permutations, p = [1, 2] and p = [2, 1]. For p = [1, 2], the process is the following:

  1. the first jury member tells a task; 
  2. the second jury member tells a task; 
  3. the first jury member doesn't have any tasks left to tell, so they are skipped; 
  4. the second jury member tells a task. 



So, the second jury member has told two tasks in a row (in succession), so the permutation is not nice.

For p = [2, 1], the process is the following:

  1. the second jury member tells a task; 
  2. the first jury member tells a task; 
  3. the second jury member tells a task. 



So, this permutation is nice.
import static java.util.Arrays.*;

import java.math.*;

public class C {

	public Object solve () {
		int N = sc.nextInt();
		int [] C = sc.nextInts();

		int M = maximum(C);
		int A = 0, B = 0;
		for (int x : C)
			if (x == M)
				++A;
			else if (x == M-1)
				++B;

		if (A > 1)
			return F[N];

		if (B == 0)
			return 0;

		long res = (F[N] * modInv(F[B+1]));
		res = mod(res * (F[B+1] - F[B]));
		return res;
	}

	private static final int CONTEST_TYPE = 2;

	private static long [] F;

	private static void init () {
		F = modFact(200010);
	}

	private static final int MOD = 998244353;
	/**
	 * For every i in [0,N), bits[i] is the list of i's bits, in increasing order.
	 */
	int [][] bits (int N) {
		int M = 1 << N;
		int [][] res = new int [M][];
		for (int m = 0; m < M; ++m) {
			res[m] = new int [Integer.bitCount(m)];
			int t = m;
			for (int i = 0; i < res[m].length; ++i) {
				int j = (t & (-t));
				res[m][i] = Integer.numberOfTrailingZeros(j);
				t -= j;
			}
		}
		return res;
	}
	private static int maximum (int ... A) { return stream(A).max().getAsInt(); }
	private static long mod (long x) { return mod(x, MOD); }
	private static long mod (long x, long mod) { return ((x % mod) + mod) % mod; }
	private static long [] modFact (int N) {
		long [] res = new long [N+1]; res[0] = 1;
		for (int i = 1; i <= N; ++i)
			res[i] = mod(res[i-1] * i);
		return res;
	}
	private static long modInv (long x) { return modInv(x, MOD); }
	private static long modInv (long x, int mod) { return BigInteger.valueOf(x).modInverse(BigInteger.valueOf(mod)).longValue(); }
	//////////////////////////////////////////////////////////////////////////////////// OFF
	private static IOUtils.MyScanner sc = new IOUtils.MyScanner();
	private static class IOUtils {
		public static class MyScanner {
			public String next () { newLine(); return line[index++]; }
			public int nextInt () { return Integer.parseInt(next()); }
			public String nextLine () { line = null; return readLine(); }
			public String [] nextStrings () { return split(nextLine()); }
			public int [] nextInts () {
				String [] S = nextStrings(); int N = S.length;
				int [] res = new int [N];
				for (int i = 0; i < N; ++i)
					res[i] = Integer.parseInt(S[i]);
				return res;
			}
			//////////////////////////////////////////////
			private boolean eol () { return index == line.length; }
			private String readLine () {
				try {
					int b;
					StringBuilder res = new StringBuilder();
					while ((b = System.in.read()) < ' ')
						continue;
					res.append((char)b);
					while ((b = System.in.read()) >= ' ')
						res.append((char)b);
					return res.toString();
				} catch (Exception e) {
					throw new Error (e);
				}
			}
			private MyScanner () {
				try {
					while (System.in.available() == 0)
						Thread.sleep(1);
					start();
				} catch (Exception e) {
					throw new Error(e);
				}
			}
			private String [] line;
			private int index;
			private void newLine () {
				if (line == null || eol()) {
					line = split(readLine());
					index = 0;
				}
			}
			private String [] split (String s) { return s.length() > 0 ? s.split(" ") : new String [0]; }
		}
		private static String build (Object o, Object ... A) { return buildDelim(" ", o, A); }
		private static String buildDelim (String delim, Object o, Object ... A) {
			java.util.List<String> str = new java.util.ArrayList<>();
			append(str, o);
			for (Object p : A)
				append(str, p);
			return String.join(delim, str.toArray(new String [0]));
		}
		//////////////////////////////////////////////////////////////////////////////////
		private static java.text.DecimalFormat formatter = new java.text.DecimalFormat("#.#########");
		private static void start () { if (t == 0) t = millis(); }
		private static void append (java.util.function.Consumer<Object> f, java.util.function.Consumer<Object> g, Object o) {
			if (o.getClass().isArray()) {
				int len = java.lang.reflect.Array.getLength(o);
				for (int i = 0; i < len; ++i)
					f.accept(java.lang.reflect.Array.get(o, i));
			}
			else if (o instanceof Iterable<?>)
				((Iterable<?>)o).forEach(f::accept);
			else
				g.accept(o instanceof Double ? formatter.format(o) : o);
		}
		private static void append (java.util.List<String> str, Object o) {
			append(x -> append(str, x), x -> str.add(x.toString()), o);
		}
		private static java.io.PrintWriter pw = new java.io.PrintWriter(System.out);
		private static void flush () { pw.flush(); System.out.flush(); }
		private static void print (Object o, Object ... A) {
			String res = build(o, A);
			if (DEBUG == 2)
				err(res, '(', time(), ')');
			if (res.length() > 0)
				pw.println(res);
			if (DEBUG == 1)
				flush();
		}
		private static void err (Object o, Object ... A) { System.err.println(build(o, A)); }
		private static int DEBUG;
		private static void exit () {
			String end = "------------------" + System.lineSeparator() + time();
			switch(DEBUG) {
			case 1: print(end); break;
			case 2: err(end); break;
			}
			IOUtils.pw.close();
			System.out.flush();
			System.exit(0);
		}
		private static long t;
		private static long millis () { return System.currentTimeMillis(); }
		private static String time () { return "Time: " + (millis() - t) / 1000.0; }
		private static void run (int N) {
			try { DEBUG = Integer.parseInt(System.getProperties().get("DEBUG").toString()); }
			catch (Throwable t) {}

			for (int n = 1; n <= N; ++n) {
				Object res = new C().solve();
				if (res != null) {
					@SuppressWarnings("all")
					Object o = CONTEST_TYPE == 0 ? "Case #" + n + ": " + build(res) : res;
					print(o);
				}
			}
			exit();
		}
	}
	////////////////////////////////////////////////////////////////////////////////////
	public static void main (String[] args) {
		@SuppressWarnings("all")
		int N = CONTEST_TYPE == 1 ? 1 : sc.nextInt();
		init();
		IOUtils.run(N);
	}
}
