#include <bits/stdc++.h>
using namespace std;
template <typename T>
T fact(T n) {
  return (n == 1 || n == 0) ? 1 : n * fact(n - 1);
}
bool sortbysec(const pair<int, int> &a, const pair<int, int> &b) {
  return (a.second < b.second);
}
int subarraysum(int arr[], int n, int sum) {
  int curr_sum = arr[0], start = 0, i;
  for (i = 1; i <= n; i++) {
    while (curr_sum > sum && start < i - 1) {
      curr_sum = curr_sum - arr[start];
      start++;
    }
    if (curr_sum == sum) {
      if (start != i - 1) return 1;
    }
    if (i < n) curr_sum = curr_sum + arr[i];
  }
  return 0;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int t;
  cin >> t;
  while (t--) {
    int n;
    cin >> n;
    int a[n];
    for (int i = 0; i < n; i++) cin >> a[i];
    int c = 0;
    for (int i = 0; i < n; i++) {
      int x = a[i];
      if (subarraysum(a, n, x)) c++;
    }
    cout << c << endl;
  }
  return 0;
}
