#include <bits/stdc++.h>
using namespace std;
int main() {
  std::ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  long long t, ans, n, i, cs, j;
  cin >> t;
  while (t--) {
    ans = 0;
    cin >> n;
    vector<long long> a(n);
    map<long long, long long> make_pair;
    for (i = 0; i <= n - 1; i++) cin >> a[i];
    for (i = 0; i <= n - 1; i++) make_pair[a[i]]++;
    for (i = 0; i <= n - 1; i++) {
      cs = a[i];
      for (j = i + 1; j <= n - 1; j++) {
        cs += a[j];
        if (make_pair.count(cs)) {
          ans += make_pair[cs];
          make_pair.erase(cs);
        }
      }
    }
    cout << ans << "\n";
  }
}
