#include<bits/stdc++.h>
using namespace std;
int a[110],b[25010];
int t,n;
long long ans;
int maxa;
queue<int > q;
int main()
{
cin>>t;
while(t--)
{
cin>>n;
ans=n;
maxa=-1;
memset(b,0,sizeof(b));
memset(a,0,sizeof(a));
for(int i=1;i<=n;i++)
{
cin>>a[i];
if(a[i]>maxa)
maxa=a[i];
if(b[a[i]]==0)
{
b[a[i]]=3;
q.push(a[i]);
}
else ans--;
}
int l=n;
while(!q.empty())
{
int u=q.front();
q.pop();
if(b[u]!=2)
for(int i=1;i<=l;i++)
{
int x=a[i]+u;
if(x>=25000||x>maxa)
continue;
if(b[x]==0)
{
l++;
a[l]=x;
b[x]=1;
q.push(a[i]);
}
else if(b[x]==3)
{
ans--;
b[x]=2;
}
}
}
cout<<ans<<endl;
}
return 0;
}