#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int t;
  cin >> t;
  while (t--) {
    int n, max = 0, count1 = 0;
    cin >> n;
    vector<int> v;
    for (int i = 0; i < n; i++) {
      int x;
      cin >> x;
      v.push_back(x);
      if (max < x) {
        max = x;
      }
    }
    int c = v[0];
    for (int i = 0; i < v.size(); i++) {
      if (v[i] == c) {
        count1++;
      }
      c = v[i];
    }
    if (count1 == n) {
      cout << "0" << endl;
    } else {
      vector<int> v1(10000);
      map<int, int> mp;
      long long int sum;
      for (int i = 0; i < n; i++) {
        sum = v[i];
        for (int j = i + 1; j < n; j++) {
          sum = sum + v[j];
          if (sum <= 8000) {
            v1[sum] = 1;
          }
        }
      }
      int count = 0;
      for (int i = 0; i < n; i++) {
        if (v1[v[i]]) {
          count++;
        }
      }
      cout << count << endl;
    }
  }
}
