#include <iostream>
#include <bitset>
#include <cstring>
#include <cstdio>
#include <algorithm>
int read()
{
int x = 0;
char c = getchar();
while(!isdigit(c))
{
c = getchar();
}
while(isdigit(c))
{
x = x * 10 + c - 48;
c = getchar();
}
return x;
}
const int maxn = 25000;
int a[110];
std::bitset<maxn + 10>f;
int main()
{
int T = read();
while(T--)
{
f.reset();
f[0] = 1;
int n = read(), ans = 0;
for (int i = 1; i <= n; ++i)
{
a[i] = read();
}
std::sort(a + 1, a + n + 1);
for (int i = 1; i <= n; ++i)
{
if(f[a[i]])
{
++ans;
continue;
}
for (int j = a[i]; j <= a[n]; j <<= 1)
{
f |= f << j;
}
}
printf("%d\n", n - ans);
}
return 0;
}