Pinkie Pie has bought a bag of patty-cakes with different fillings! But it appeared that not all patty-cakes differ from one another with filling. In other words, the bag contains some patty-cakes with the same filling.

Pinkie Pie eats the patty-cakes one-by-one. She likes having fun so she decided not to simply eat the patty-cakes but to try not to eat the patty-cakes with the same filling way too often. To achieve this she wants the minimum distance between the eaten with the same filling to be the largest possible. Herein Pinkie Pie called the distance between two patty-cakes the number of eaten patty-cakes strictly between them.

Pinkie Pie can eat the patty-cakes in any order. She is impatient about eating all the patty-cakes up so she asks you to help her to count the greatest minimum distance between the eaten patty-cakes with the same filling amongst all possible orders of eating!

Pinkie Pie is going to buy more bags of patty-cakes so she asks you to solve this problem for several bags!


-----Input-----

The first line contains a single integer $T$ ($1 \le T \le 100$): the number of bags for which you need to solve the problem.

The first line of each bag description contains a single integer $n$ ($2 \le n \le 10^5$): the number of patty-cakes in it. The second line of the bag description contains $n$ integers $a_1, a_2, \ldots, a_n$ ($1 \le a_i \le n$): the information of patty-cakes' fillings: same fillings are defined as same integers, different fillings are defined as different integers. It is guaranteed that each bag contains at least two patty-cakes with the same filling. 

It is guaranteed that the sum of $n$ over all bags does not exceed $10^5$.


-----Output-----

For each bag print in separate line one single integer: the largest minimum distance between the eaten patty-cakes with the same filling amongst all possible orders of eating for that bag.


-----Example-----
Input
4
7
1 7 1 6 4 4 6
8
1 1 4 6 4 6 4 7
3
3 3 3
6
2 5 2 3 1 4

Output
3
2
0
4



-----Note-----

For the first bag Pinkie Pie can eat the patty-cakes in the following order (by fillings): $1$, $6$, $4$, $7$, $1$, $6$, $4$ (in this way, the minimum distance is equal to $3$).

For the second bag Pinkie Pie can eat the patty-cakes in the following order (by fillings): $1$, $4$, $6$, $7$, $4$, $1$, $6$, $4$ (in this way, the minimum distance is equal to $2$).

Difficulty: interview

Starter code:

Solutions:
import sys
input = sys.stdin.readline
for f in range(int(input())):
    n=int(input())
    a=list(map(int,input().split()))
    patties=[0]*n
    mx=0
    for p in a:
        patties[p-1]+=1
        mx=max(patties[p-1],mx)
    mxs=0
    for p in patties:
        if p==mx:
            mxs+=1
    rest=n-mx
    rest-=mxs
    rest+=1
    spots=mx-1
    print(rest//spots)


from collections import Counter
import math

testCases = int(input())

for _ in range(testCases):

    n = int(input())
    ar = list(map(int, input().split()))
    cntr = dict(Counter(ar))
    cntr = Counter(cntr.values())

    mn = float("inf")

    for x in cntr:
        if x!=1:
            mn = min(mn, int(math.floor((n-cntr[x])/(x-1)))-1)
            
    print(mn)

T = int(input())

for case in range(T):
    n = int(input())
    a = list(map(int, input().split()))

    sums = {}
    for cake in a:
        if sums.get(cake):
            sums[cake] += 1
        else:
            sums[cake] = 1

    sums = list(sums.values())
    sums.sort()

    m = sums[-1]
    nummax = 0
    for sum in sums:
        if sum == m:
            nummax += 1

    ans = (n-nummax)//(m-1) - 1
    print(ans)


from sys import stdin
for testcase in range(int(stdin.readline())):
    n = int(stdin.readline())
    cnt = [0] * (n + 10)
    for i in map(int, stdin.readline().split()):
        cnt[i] += 1
        
    cnt.sort(reverse=True)
    i = 0
    while i < n and cnt[i] == cnt[0]:
        i += 1
    
    group = [i - 1] * (cnt[0] - 1)
    
    cur = 0
    for num in cnt[i:]:
        while num > 0:
            num -= 1
            group[cur] += 1
            cur = (cur + 1) % len(group)
    print(min(group))
    
        


from sys import stdin
from collections import deque
import heapq

tt = int(stdin.readline())

for loop in range(tt):

    n = int(stdin.readline())
    a = list(map(int,stdin.readline().split()))
    dic = {}
    for i in a:
        if i not in dic:
            dic[i] = 0
        dic[i] += 1
    

    l = 0
    r = n

    while r-l != 1:

        m = (l+r) // 2
        
        q = []
        wait = deque([])
        for i in dic:
            heapq.heappush(q, (-1 * dic[i] , i) )

        flag = True
        for i in range(n):

            while len(wait) > 0 and wait[0][0] < i-m:
                last,count,num = wait.popleft()
                heapq.heappush( q, (count,num))
            
            if len(q) == 0:
                flag = False
                break
            
            count,num = heapq.heappop(q)
            count += 1
            if count != 0:
                wait.append( (i,count,num) )

        if flag:
            l = m
        else:
            r = m

    print (l)


for _ in range(int(input())):
    n = int(input())
    arr = list(map(int, input().split()))
    freq = [0] * n
    for e in arr:
        freq[e-1] += 1
    m = max(freq)
    c = freq.count(m)
    print((n-(m*c))//(m-1)+c-1)


for i in ' '*int(input()):
    n=int(input())
    L=list(map(int,input().split()))
    L.sort()
    pt=0
    M=[]
    ct=0
    while pt<n-1:
        pt+=1
        ct+=1
        if L[pt]!=L[pt-1]:
            M.append(ct)
            ct=0
    ct+=1
    M.append(ct)
    M.sort()
    mx=max(M)
    count=0
    mxcount=0
    for i in M:
        if i==mx:mxcount+=1
        else:count+=i
    ans=mxcount+(count//(mx-1))-1
    print(ans)

import sys

T = int(sys.stdin.readline().strip())
for t in range(T):
    n = int(sys.stdin.readline().strip())
    a = list(map(int, sys.stdin.readline().strip().split()))
    a.sort()
    m = -1
    mc = 0
    c = 1
    for i in range (1, n):
        if a[i] == a[i - 1]:
            c = c + 1
        else:
            if c > m:
                m = c
                mc = 1
            elif c == m:
                mc = mc + 1
            c = 1
    if c > m:
        m = c
        mc = 1
    elif c == m:
        mc = mc + 1
    print((n - m * mc) // (m - 1) + mc - 1)


t=1
t=int(input())
for _ in range(t):
    n=int(input())
    a=list(map(int,input().split()))
    data=[0]*(n+1)
    for i in range(n):
        data[a[i]]+=1
    S=set(a)
    m=len(S)

    def cond(t):
        q,r=n//(t+1),n%(t+1)
        if r>m:
            return False
        check=0
        for i in range(1,n+1):
            if data[i]>q+1:
                return False
            elif data[i]==q+1:
                check+=1
        return r>=check

    ok=0
    ng=n
    while ng-ok>1:
        test=(ng+ok)//2
        if cond(test):
            ok=test
        else:
            ng=test

    print(ok)


from collections import *
for _ in range(int(input())):
    n=int(input())
    ai=list(map(int,input().split()))
    count=Counter(ai)
    mostc=count.most_common()
    num=mostc[0][0]
    numcount=mostc[0][1]
    ans=-1

    for num in count:
        if count[num]==numcount:
            count[num]=0
            ans+=1
    divisions=numcount-1
    temp=0
    for i in list(count.values()):
        temp+=i
        if temp>=divisions:
            temp-=divisions
            ans+=1
    print(ans)


from collections import Counter
import sys
input = sys.stdin.readline

T = int(input())

for t in range(T):
    N = int(input())
    A = [int(_) for _ in input().split()]

    cc = Counter(A)

    mc = cc.most_common()
    vm = mc[0][1]

    nb = 0
    for _, c in mc:
        if c != vm:
            break
        nb += 1

    nbc = nb * vm
    left = N - nbc
    spaces = vm - 1
    min_blank = left//spaces
    print(min_blank + nb -1)


from collections import defaultdict as dd
import math
import sys
input=sys.stdin.readline
def nn():
	return int(input())

def li():
	return list(input())

def mi():
	return list(map(int, input().split()))

def lm():
	return list(map(int, input().split()))


def solve():
	n  = nn()
	cakes = lm()
	cake_count = [0]*(n+10)
	for cake in cakes:
		cake_count[cake]+=1
	most = max(cake_count)
	k = 0
	for num in cake_count:
		if num==most:
			k+=1
	print(  (n-most*k)//(most-1) +(k-1)    )


q = nn()

for _ in range(q):
	solve()


for _ in range(int(input())):
    n = int(input())
    x = [0]*n
    l = list(map(int,input().split()))
    for i in l:
        x[i-1]+=1
    x.sort()
    x.reverse()
    m = x[0]
    ap = 0
    for i in x:
        if i==m: ap+=1
        else: break
    print(((n-ap)//(m-1))-1)

# import sys; input = sys.stdin.buffer.readline
# sys.setrecursionlimit(10**7)
from collections import defaultdict
con = 10 ** 9 + 7; INF = float("inf")

def getlist():
	return list(map(int, input().split()))

#処理内容
def main():
	T = int(input())
	for _ in range(T):
		N = int(input())
		A = getlist()
		D = defaultdict(int)
		for i in A:
			D[i] += 1

		D2 = defaultdict(int)
		for i in D:
			D2[D[i]] += 1

		# print(D2)
		val = 0
		num = 0
		for i in D2:
			if i > val:
				val = i
				num = D2[i]

		# print(val, num)
		ans = int((N - num) // (val - 1)) - 1
		print(ans)


def __starting_point():
	main()
__starting_point()

#!/usr/bin/env python3

import collections

def main():
    for _ in range(int(input())):
        n = int(input())
        a = list(map(int, input().split()))
        a = collections.Counter(a)
        a = [a[i] for i in a]
        a = sorted(a)[::-1]
        bins = a[0] - 1
        for i in range(1, len(a)):
            if a[i] == a[0]:
                a[i] -= 1
        rem = sum(a[1:])
        print(rem // bins)

def __starting_point():
    main()

__starting_point()

import math

T = int(input())

for i in range(T):
  n = int(input())
  #n,p,k = map(int, input().split())
  a = list(map(int,input().split()))
  #b = list(map(int,input().split()))
  #a = input()
  d = False
  A = [0]*n
  
  for i in range(n):
    A[a[i]-1]+=1

  #A.sort(reverse=True)
  ma = max(A)
  man = A.count(ma)

  #if man == 1:
  print((n-man)//(ma-1)-1)
  #print(n,ma,man)
  


import sys

def input():
	return sys.stdin.readline().rstrip()

def input_split():
	return [int(i) for i in input().split()]

testCases = int(input())
answers = []
for _ in range(testCases):
	#take input
	n = int(input())
	arr = input_split()

	counts = {a:0 for a in arr}
	for a in arr:
		counts[a] += 1

	temp = list(counts.values())
	temp.sort()
	temp.reverse()

	k = 0
	val = temp[0]
	ptr = 1
	while(ptr < len(temp)):
		if temp[ptr] != val:
			break
		ptr += 1
		k += 1

	n = n - k 

	# if val == 1:
	#val cant be 1
	ans = (n - val)//(val - 1)





	answers.append(ans)

print(*answers, sep = '\n')


mod=998244353
for _ in range (int(input())):
    n=int(input())
    a=list(map(int,input().split()))
    d=dict()
    for i in a:
        if i in d:
            d[i]+=1
        else:
            d[i]=1
    l=list()
    for i in d:
        l.append((d[i],i))
    l.sort(reverse=True)
    c=0
    lim=l[0][0]
    #print(lim)
    extra=0
    r=0
    for i in l:
        if i[0]==lim:
            r+=1
        else:
            extra+=i[0]
    if lim==1:
        print(n)
    else:
        r+=extra//(lim-1)
        print(r-1)