#P1475G. Strange Beauty

    ID: 5755 Type: RemoteJudge 5000ms 256MiB Tried: 0 Accepted: 0 Difficulty: (None) Uploaded By: Tags>dpmathnumber theorysortings*1900

Strange Beauty

No submission language available for this problem.

Description

Polycarp found on the street an array aa of nn elements.

Polycarp invented his criterion for the beauty of an array. He calls an array aa beautiful if at least one of the following conditions must be met for each different pair of indices iji \ne j:

  • aia_i is divisible by aja_j;
  • or aja_j is divisible by aia_i.

For example, if:

  • n=5n=5 and a=[7,9,3,14,63]a=[7, 9, 3, 14, 63], then the aa array is not beautiful (for i=4i=4 and j=2j=2, none of the conditions above is met);
  • n=3n=3 and a=[2,14,42]a=[2, 14, 42], then the aa array is beautiful;
  • n=4n=4 and a=[45,9,3,18]a=[45, 9, 3, 18], then the aa array is not beautiful (for i=1i=1 and j=4j=4 none of the conditions above is met);

Ugly arrays upset Polycarp, so he wants to remove some elements from the array aa so that it becomes beautiful. Help Polycarp determine the smallest number of elements to remove to make the array aa beautiful.

The first line contains one integer tt (1t101 \leq t \leq 10) — the number of test cases. Then tt test cases follow.

The first line of each test case contains one integer nn (1n21051 \leq n \leq 2 \cdot 10^5) — the length of the array aa.

The second line of each test case contains nn numbers a1,a2,,ana_1, a_2, \ldots, a_n (1ai21051 \le a_i \le 2 \cdot 10^5) — elements of the array aa.

For each test case output one integer — the minimum number of elements that must be removed to make the array aa beautiful.

Input

The first line contains one integer tt (1t101 \leq t \leq 10) — the number of test cases. Then tt test cases follow.

The first line of each test case contains one integer nn (1n21051 \leq n \leq 2 \cdot 10^5) — the length of the array aa.

The second line of each test case contains nn numbers a1,a2,,ana_1, a_2, \ldots, a_n (1ai21051 \le a_i \le 2 \cdot 10^5) — elements of the array aa.

Output

For each test case output one integer — the minimum number of elements that must be removed to make the array aa beautiful.

Samples

Sample Input 1

4
5
7 9 3 14 63
3
2 14 42
4
45 9 3 18
3
2 2 8

Sample Output 1

2
0
1
0

Note

In the first test case, removing 77 and 1414 will make array aa beautiful.

In the second test case, the array aa is already beautiful.

In the third test case, removing one of the elements 4545 or 1818 will make the array aa beautiful.

In the fourth test case, the array aa is beautiful.