**Problem Description**

_{i}MOD A

_{j}(A

_{i}≥A

_{j}).

**Input**

The first line contains an integer T, represents the number of testcases.

For each testcase, the first line contains an integer N;

the second line contains N integers, represents A

_{1},A

_{2},….,A

_{N}; (T<=20,1<=N<=100000,1<=A

_{i}<=1000000).

**Output**

For each testcase, output one line contains an integer represents the max value of A

_{i}MOD A

_{j}.

**Sample Input**

1 3 3 4 5

**Sample Output**

2

**Source**

2017绍兴市技能竞赛