#include <bits/stdc++.h>
using namespace std;
const int mod = 1000000007;
const int N = 1000005;
class cmp {
 public:
  bool operator()(long long &A, long long &B) { return A > B; }
};
bool by_sec(pair<long long, long long> &A, pair<long long, long long> &B) {
  return A.second < B.second;
}
bool is(pair<long long, long long> a, pair<long long, long long> b) {
  return !((a.first > b.second && a.second > b.second) ||
           (a.first < b.first && a.second < b.first));
}
long double dist(pair<long long, long long> p1, pair<long long, long long> p2) {
  return (long double)sqrt(
      (long double)(p1.first - p2.first) * (p1.first - p2.first) +
      (long double)(p1.second - p2.second) * (p1.second - p2.second));
}
pair<bool, vector<long long> > is_in(vector<long long> v, long long sum) {
  long long n = v.size();
  bool dp[30][1000];
  memset(dp, 0, sizeof(dp));
  ;
  for (int i = 0; i < sum + 1; i++) dp[0][i] = 0;
  for (int i = 0; i < n + 1; i++) dp[i][0] = 1;
  for (int i = 1; i < n + 1; i++)
    for (int j = 1; j < sum + 1; j++) {
      dp[i][j] = dp[i - 1][j];
      if (v[i - 1] <= j) dp[i][j] = dp[i][j] | dp[i - 1][j - v[i - 1]];
    }
  long long i = n;
  long long currSum = sum;
  vector<long long> set1, set2;
  if (!dp[n][sum]) return (make_pair(dp[n][sum], set1));
  while (i > 0 && currSum >= 0) {
    if (dp[i - 1][currSum]) {
      i--;
      set2.push_back(v[i]);
    } else {
      i--;
      currSum -= v[i];
      set1.push_back(v[i]);
    }
  }
  return make_pair(dp[n][sum], set1);
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  bool mp[8000 + 5];
  long long t;
  cin >> t;
  while (t--) {
    long long n;
    memset(mp, 0, sizeof(mp));
    ;
    cin >> n;
    vector<long long> v(n);
    for (int i = 0; i < n; i++) cin >> v[i], mp[v[i]] = 1;
    for (int i = 0; i < n; i++) {
      long long s = v[i];
      for (int j = i + 1; j < n; j++) {
        s += v[j];
        if (s <= n && mp[s]) mp[s] = 0;
      }
    }
    long long cnt = 0;
    for (int i = 0; i < n; i++)
      if (!mp[v[i]]) cnt++;
    cout << cnt << "\n";
  }
  return 0;
}
