Close Combat#12255

Close Combat

2 seconds
256 megabytes
Hard

"If you win, you live. If you lose, you die. But if you don't fight, you can't win!"

—Eren Jaeger,Attack On Titan

You are given an array of integers. You are allowed to perform the following operation at most once:

Your task is to report the maximum number of pairs (1 \le i < j \le n) such that \text{lcm}(i, \varphi(a_i)) = \text{lcm}(j, \varphi(a_j)).

^* Here denotes Euler's totient function.

^* Here denotes Least Common Multiple.

Input

The first line contains the number of test cases (1 \le t \le 10^3). The description of the test cases follows.

The first line of each test case contains a single integer (1 \le n \le 10^{5}) — the size of the array .

The second line contains integers a_1, a_2, \dots, a_n (1 \le a_i \le 10^5) — the elements of the array.

It is guaranteed that the sum of over all test cases does not exceed 2 \cdot 10^5.

Output

For each test case, print a single integer — the number of pairs that satisfy the given condition.

Examples

Example 1

Loading
Loading

Scoring

  1. Subtask ( points): (n = 2)

  2. Subtask ( points): (2 \le n \le 10)

  3. Subtask ( points): (1 \le a_i \le 100)

  4. Subtask ( points): (1 \le \sum n \le 1000)

  5. Subtask ( points): (1 \le a_i \le 1000)

  6. Subtask ( points): No additional constraints.