#include<bits/stdc++.h>
using namespace std;
#define lp(i,a,n) for(i=a;i<n;i++)
#define ld(i,a,n) for(i=n-1;i>=a;i--)
#define ll long long
#define dd double
#define mod 10000007
#define inf 1e18
#define inp(t) cin>>t; while(t--)
int main(){
	int t;
	ios::sync_with_stdio(false);
	inp(t){
		ll n,i,j,k;
		cin>>n;
		int arr[n];
		lp(i,0,n)
		cin>>arr[i];
		int ans;
		int sm=accumulate(arr,arr+n,0);
		int chk=1;
		lp(i,0,n){
			k=n-i;
			int val;
			if(sm%k==0)
			val=sm/k;
			else
			continue;
			int smm=0;
			lp(j,0,n){
				smm+=arr[j];
				if(smm<val)
				continue;
				else if(smm==val&&j!=n-1){
					smm=0;
					continue;
				}
				else if(smm==val&&j==n-1){
					chk=0;
					ans=i;
					break;
				}
				else{
					smm=0;
					break;
				}
				
				
			}
			if(chk==0)
				break;
		}
		cout<<ans<<endl;
		
		}
		
		} 
