You are given a sequence $A_1, A_2, \ldots, A_N$. For each valid $i$, the star value of the element $A_i$ is the number of valid indices $j < i$ such that $A_j$ is divisible by $A_i$.
Chef is a curious person, so he wants to know the maximum star value in the given sequence. Help him find it.

-----Input-----
- The first line of the input contains a single integer $T$ which denotes the number of test cases.
- The first line of each test case contains a single integer $N$ .
- The second line of each test case contains $N$ space-separated integers $A_1, A_2, \ldots, A_N$.

-----Output-----
For each test case, print a single line containing one integer ― the maximum star value.

-----Constraints-----
- $1 \le T \le 10$
- $1 \le N \le 10^5$
- $1 \le A_i \le 10^6$ for each valid $i$ 
- Sum of $N$ over all test cases does not exceed $100,000$.

-----Subtasks-----
Subtask #1 (20 points): sum  of $N$ over all test cases does not exceed $5,000$
Subtask #2 (80 points): original constraints

-----Example Input-----
1
7
8 1 28 4 2 6 7

-----Example Output-----
3

-----Explanation-----
$A_5 = 2$ divides $4$, $28$ and $8$, so its star value is $3$. There is no element with a higher star value.

Difficulty: interview

Starter code:

Solutions:
T = int(input())
for _ in range(T):
 n = int(input())
 arr = list(map(int, input().split()))
 a = [0 for _ in range(max(arr)+1)]
 star_val = []
 for i in range(len(arr)):
  j = 1
  val = 0
  while j*arr[i] <= len(a):
   val += a[j*arr[i]-1]
   j += 1
  star_val.append(val)
  a[arr[i]-1] += 1
 print(max(star_val))

T = int(input())
for _ in range(T):
 n = int(input())
 arr = list(map(int, input().split()))
 values = []
 if len(arr) == 1:
  print(0)
 else:
  for i in range(1, len(arr)):
   star = 0
   for j in range(i):
    if arr[j]%arr[i] == 0:
     star += 1
   values.append(star)
  print(max(values))

# cook your dish here
for t in range(int(input())):
 n=int(input())
 l=list(map(int,input().split()))
 l1=[ ]
 for i in range(len(l)):
  c=0
  for j in range(i):
   if l[j]%l[i]==0:
    c+=1
  l1.append(c)
 print(max(l1))

# cook your dish here
for _ in range(int(input())):
 n = int(input())
 lst = list(map(int,input().split()))
 val = 0
 for i in range(n-1,-1,-1):
  temp = 0
  for j in range(i-1,-1,-1):
   if(lst[j]%lst[i] == 0):
    temp = temp + 1
  if(temp >= val):
   val = temp
  if(val == i ):
   break
 print(val)

for _ in range(int(input())):
 n = int(input())
 lst = list(map(int,input().split()))
 val = 0
 for i in range(n-1,-1,-1):
  temp = 0
  for j in range(i-1,-1,-1):
   if(lst[j]%lst[i] == 0):
    temp = temp + 1
  if(temp >= val):
   val = temp
  if(val == i ):
   break
 print(val)

import sys
from math import sqrt
input = sys.stdin.readline
t = int(input())
for _ in range(t):
 n = int(input())
 a = list(map(int, input().strip().split()))
 max_star = [0] * (10 ** 6 + 5)
 ans = 0
 for i in range(n):
  x = a[i]
  if i > 0:
   ans = max(ans, max_star[x])
  for j in range(1, int(sqrt(x))+1):
   if x % j == 0:
    tempnum = int(x / j)
    if j != tempnum:
     max_star[j] += 1
     max_star[tempnum] += 1
    else:
     max_star[j] += 1
 print(ans)

for u in range(int(input())):
 n = int(input())
 x = [int(w) for w in input().split()]
 
 ans = 0
 for i in range(1, n):
  c = 0
  for j in range(i):
   if x[j] % x[i] == 0:
    c += 1
  #print(c)    
  ans = max(ans, c)
  
 print(ans)

import math 
from functools import reduce

def printDivisors(n):    
 return list(set(reduce(list.__add__, 
    ([i, n//i] for i in range(1, int(n**0.5) + 1) if n % i == 0))))
for _ in range(int(input())):
 n=int(input())
 if n>10**4:
  List=[int(y) for y in input().split()]
  Dict=dict()
  Answ=0
  for i in range(n):
   Divisor_List=printDivisors(List[i])
   if List[i] in Dict:
    if(Dict[List[i]]>Answ):
     Answ=Dict[List[i]]
   for i in Divisor_List:
    if i in Dict:
     Dict[i]+=1
    else:
     Dict[i]=1
  print(Answ)
 else:
  a=list(map(int,input().split()))
  h=[0]*1000001
  m=0
  for j in range(n-1,1,-1):
   x=j-1
   c=0
   if h[a[j]]==0:
    while(x>=0):
     if a[x]%a[j]==0:
      h[a[x]]=1
      c=c+1
     x=x-1
    m=max(m,c)
    h[a[j]]=1
  print(m)

import math 
from functools import reduce

def printDivisors(n):    
 return list(set(reduce(list.__add__, 
    ([i, n//i] for i in range(1, int(n**0.5) + 1) if n % i == 0))))
for _ in range(int(input())):
 N=int(input())
 List=[int(y) for y in input().split()]
 Dict=dict()
 Answ=0
 for i in range(N):
  Divisor_List=printDivisors(List[i])
  if List[i] in Dict:
   if(Dict[List[i]]>Answ):
    Answ=Dict[List[i]]
  for i in Divisor_List:
   if i in Dict:
    Dict[i]+=1
   else:
    Dict[i]=1
 print(Answ)

for _ in range(int(input())):
 N = int(input())
 L = list(map(int, input().split()))
 L2 = [0]*N
 res = 0
 n = N-1
 while n!=0:
  if L2[n]==1:
   n = n-1
   continue
  req = 0
  a = L[n]
  for i in range(n-1, -1, -1):
   if L[i]%L[n]==0:
    L2[i] = 1
    req = req+1
  
  res = max(req, res)
  n = n-1
 
 print(res)

t=int(input())
for z in range(t):
 n=int(input())
 a=list(map(int,input().split()))
 h=[0]*1000001
 m=0
 for j in range(n-1,1,-1):
  x=j-1
  c=0
  if h[a[j]]==0:
   while(x>=0):
    if a[x]%a[j]==0:
     h[a[x]]=1
     c=c+1
    x=x-1
   m=max(m,c)
   h[a[j]]=1
 print(m)

for _ in range(int(input())):
 n=int(input())
 a=list(map(int,input().split()))
 h=[0]*1000001
 m=0
 for j in range(n-1,1,-1):
  x=j-1
  c=0
  if h[a[j]]==0:
   while(x>=0):
    if a[x]%a[j]==0:
     h[a[x]]=1
     c=c+1
    x=x-1
   m=max(m,c)
   h[a[j]]=1
 print(m)

from sys import stdin
from numpy import arange, array

for _ in arange(int(stdin.readline())):
 N = int(stdin.readline())
 a = array(list(map(int, stdin.readline().split())))
 h = [0] * N
 maxx = 0
 for j in range(N - 1, 1, -1):
  k = 0
  if h[j] == 0:
   for i in range(j+1):
    if a[i] % a[j] == 0:
     k += 1
     h[i] = 1
  maxx = max(k - 1, maxx)
 print(maxx)


from numpy import arange,array
from sys import stdin

for _ in arange(int(stdin.readline())):
 N = int(stdin.readline())
 a = array(list(map(int, stdin.readline().split())))
 b = array(a[::-1])
 maxx = 0
 h = array([0]*N)
 for index, items in enumerate(b):
  k = 0
  if h[N - index - 1] == 0:
   for i in range(N - index):
    if a[i] % items == 0:
     k += 1
     h[i] = 1
  maxx = max(k - 1, maxx)
  # print(h)
 print(maxx)


import numpy as np
import sys

for _ in np.arange(int(sys.stdin.readline())):
 N = int(sys.stdin.readline())
 a = np.array(list(map(int, sys.stdin.readline().split())))
 b = np.array(a[::-1])
 maxx = 0
 h = np.array([0]*N)
 for index, items in enumerate(b):
  k = 0
  if h[N - index - 1] == 0:
   for i in range(N - index):
    if a[i] % items == 0:
     k += 1
     h[i] = 1
  maxx = max(k - 1, maxx)
  # print(h)
 print(maxx)


import numpy as np

for _ in range(int(input())):
 N = int(input())
 a = np.array(list(map(int, input().split())))
 b = np.array(a[::-1])
 maxx = 0
 h = np.array([0]*N)
 for index, items in enumerate(b):
  k = 0
  if h[N - index - 1] == 0:
   for i in range(N - index):
    if a[i] % items == 0:
     k += 1
     h[i] = 1
  maxx = max(k - 1, maxx)
  # print(h)
 print(maxx)


for _ in range(int(input())):
 N = int(input())
 a = list(map(int, input().split()))
 b = a[::-1]
 maxx = 0
 h = [0] * N
 for index, items in enumerate(b):
  k = 0
  if h[N - index - 1] == 0:
   for i in range(N - index):
    if a[i] % items == 0:
     k += 1
     h[i] = 1
  maxx = max(k-1, maxx)
 print(maxx)


for _ in range(int(input())):
 N = int(input())
 a = list(map(int, input().split()))
 b = a[::-1]
 maxx = 0
 h = [0] * N
 for index, items in enumerate(b):
  k = 0
  if h[N - index - 1] == 0:
   for i in range(N - index):
    if a[i] % items == 0:
     k += 1
     h[i] = 1
  maxx = max(k-1, maxx)
 print(maxx)


for _ in range(int(input())):
 N = int(input())
 a = list(map(int, input().split()))
 b = a[::-1]
 maxx = 0
 dic = {}
 for index, items in enumerate(b):
  k = 0
  try:
   if dic[items]==0:
    pass
  except Exception as e:
   for i in range(N - index):
    if a[i] % items == 0:
     k += 1
     dic[a[i]] = 0
  maxx = max(k-1, maxx)
 print(maxx)


for _ in range(int(input())):
 N = int(input())
 a = list(map(int, input().split()))
 b = a[::-1]
 maxx = 0
 dic = {}
 for index, items in enumerate(b):
  k = 0
  if items not in list(dic.keys()):
   for i in range(N - index):
    if a[i] % items == 0:
     k += 1
     dic[a[i]] = 0
  maxx = max(k-1, maxx)
 print(maxx)


for _ in range(int(input())):
 N=int(input())
 a=list(map(int,input().split()))
 maxx=0
 for index,items in enumerate(a):
  k=0
  for i in range(index):
   if a[i]%items==0:
    k+=1
  maxx=max(k,maxx)
 print(maxx)