#include <bits/stdc++.h>
using namespace std;
vector<long long> v;
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  ;
  long long t, n, x;
  cin >> t;
  while (t--) {
    cin >> n;
    long long m[n + 5];
    bool flag[n + 5];
    memset(m, 0, sizeof(m));
    memset(flag, false, sizeof(flag));
    for (long long i = 0; i < n; i++) {
      cin >> x;
      v.push_back(x);
      m[x]++;
    }
    long long mx = *max_element(v.begin(), v.end());
    for (long long i = 0; i < n; i++) {
      long long sum = v[i];
      for (long long j = i + 1; j < n; j++) {
        sum += v[j];
        if (sum > mx) break;
        if (m[sum] && !flag[sum]) flag[sum] = true;
      }
    }
    long long ans = 0;
    for (long long i = 0; i <= n; i++) {
      if (flag[i]) ans += m[i];
    }
    cout << ans << endl;
    v.clear();
  }
  return 0;
}
