#include <bits/stdc++.h>
using namespace std;
void solve() {
  int n;
  cin >> n;
  int num[n], test[n], sum = 0;
  unordered_map<int, int> m;
  for (int i = 0; i < n; i++) {
    cin >> num[i];
    m[num[i]]++;
    test[i] = num[i];
  }
  sort(test, test + n);
  int c = 0;
  for (int i = 0; i < n - 1; i++) {
    sum = num[i];
    for (int j = i + 1; j < n; j++) {
      sum += num[j];
      if (sum > 8000) break;
      if (binary_search(test, test + n, sum)) {
        if (m[sum] > 0) {
          c += m[sum];
          m[sum] = 0;
        }
      }
    }
  }
  cout << c << endl;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int t;
  cin >> t;
  while (t--) {
    solve();
  }
}
