#include <bits/stdc++.h>
using namespace std;
const int MOD = 1e9 + 7;
const int N = 2e6 + 7;
bool f(int a[], int n, int k) {
  int cs = a[0];
  int start = 0;
  for (int i = 1; i <= n; i++) {
    while (cs > k && start < i - 1) {
      cs = cs - a[start];
      start += 1;
    }
    if (cs == k && start != i - 1) {
      return true;
    }
    cs += a[i];
  }
  return false;
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  int t;
  cin >> t;
  while (t--) {
    int n;
    cin >> n;
    int a[n];
    for (int i = 0; i < n; i++) {
      cin >> a[i];
    }
    int cnt = 0;
    for (int i = 0; i < n; i++) {
      if (f(a, n, a[i])) {
        cnt += 1;
      }
    }
    cout << cnt << "\n";
  }
  return 0;
}
