{"raw_statement":[{"iden":"statement","content":"Alex is a very clever boy, after all he is the son of the greatest watchmaker in Odin.\n\nOne day, Alex was playing with some old watches and he found n gears, each gear has ai teeth in it. Alex likes to make beautiful pairs of gears, he thinks a pair of gears is beautiful if we attach the two gears together and spin the first gear exactly one rotation, then the other gear spins an integer number of rotations. For example a pair of _8_ and _4_ is beautiful, whereas a pair of _8_ and _5_ isn't, neither is pair of _4_ and _8_.\n\nNow Alex is curious, he wants to know how many beautiful pairs are there. Counting is not Alex's thing, so he asked you to help him.\n\nThe first line of input contains one integer T: The number of test cases you need to process.\n\nEach test case consists of two lines. The first line is a single integer n: the number of gears Alex has. The second line contains n space separated integers ai: the number if teeth in the ith gear.\n\n1 ≤ n ≤ 104\n\n2 ≤ ai ≤ 106\n\nFor each testcase print a single integer: the number of distinct pairs that satisfy the problem statement.\n\nnote that we consider two pair distinct when they differ by at least one gear.\n\nIn the first sample the pairs are: _(4,8) , (4,12) , (6,12)_\n\n"},{"iden":"input","content":"The first line of input contains one integer T: The number of test cases you need to process.Each test case consists of two lines. The first line is a single integer n: the number of gears Alex has. The second line contains n space separated integers ai: the number if teeth in the ith gear.1 ≤ n ≤ 1042 ≤ ai ≤ 106"},{"iden":"output","content":"For each testcase print a single integer: the number of distinct pairs that satisfy the problem statement."},{"iden":"examples","content":"Input254 6 7 8 1262 2 2 3 3 4Output37"},{"iden":"note","content":"note that we consider two pair distinct when they differ by at least one gear.In the first sample the pairs are: _(4,8) , (4,12) , (6,12)_"}],"translated_statement":null,"sample_group":[],"show_order":[],"formal_statement":"**Definitions**  \nLet $ T \\in \\mathbb{Z} $ be the number of test cases.  \nFor each test case, let $ n \\in \\mathbb{Z} $ be the number of gears, and let $ A = (a_1, a_2, \\dots, a_n) $ be a sequence of integers representing the number of teeth on each gear.\n\n**Constraints**  \n1. $ 1 \\leq T \\leq 10^4 $  \n2. For each test case:  \n   - $ 1 \\leq n \\leq 10^4 $  \n   - $ 2 \\leq a_i \\leq 10^6 $ for all $ i \\in \\{1, \\dots, n\\} $\n\n**Objective**  \nFor each test case, count the number of **unordered distinct pairs** $ \\{a_i, a_j\\} $ with $ i \\ne j $ such that:  \n$$\n\\frac{a_i}{a_j} \\in \\mathbb{Z} \\quad \\text{or} \\quad \\frac{a_j}{a_i} \\in \\mathbb{Z}\n$$  \n(i.e., one gear’s tooth count divides the other’s).","simple_statement":"Count the number of distinct pairs of gears where, if one gear spins once, the other spins an integer number of times.","has_page_source":false}