#include <bits/stdc++.h>
using namespace std;
void solve() {
  long long int n;
  cin >> n;
  long long int arr[n];
  for (long long int i = 0; i < n; ++i) {
    cin >> arr[i];
  }
  long long int cnt = 0;
  for (long long int j = 0; j < n; ++j) {
    long long int cur_sum = arr[0];
    long long int start = 0;
    long long int sum = arr[j];
    long long int i;
    for (i = 1; i <= n; i++) {
      while (cur_sum > sum && start < i - 1) {
        cur_sum -= arr[start];
        start++;
      }
      if (cur_sum == sum) {
        if (start != i - 1) {
          cnt++;
          break;
        }
      }
      if (i < n) {
        cur_sum += arr[i];
      }
    }
  }
  cout << cnt;
  cout << '\n';
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  long long int t = 1;
  cin >> t;
  while (t--) {
    solve();
  }
  return 0;
}
