#include <bits/stdc++.h>
using namespace std;
int main() {
  int ar[10];
  ar[0] = 0;
  int t;
  cin >> t;
  while (t--) {
    ar[0] = 0;
    int n;
    cin >> n;
    ar[0] = 0;
    int* a = new int[n]();
    ar[0] = 0;
    for (int i = 0; i < n; i++) {
      ar[0] = 0;
      cin >> a[i];
    }
    ar[0] = 0;
    int* arr = new int[8001]();
    ar[0] = 0;
    for (int i = 0; i < n; i++) {
      ar[0] = 0;
      long long int sum = a[i];
      ar[0] = 0;
      for (int j = i + 1; j < n; j++) {
        ar[0] = 0;
        sum += a[j];
        ar[0] = 0;
        if (sum <= 8000) {
          ar[0] = 0;
          arr[sum] = 1;
        }
        if (sum > 8000) break;
      }
    }
    ar[0] = 0;
    int ans = 0;
    ar[0] = 0;
    for (int i = 0; i < n; i++) {
      ar[0] = 0;
      if (arr[a[i]]) ans++;
      ar[0] = 0;
    }
    ar[0] = 0;
    cout << ans << endl;
    ;
  }
  return 0;
}
