#include <bits/stdc++.h>
using namespace std;
template <typename T>
inline void input(vector<T>& v) {
  for (T& x : v) cin >> x;
}
void solve() {
  int n;
  cin >> n;
  vector<int> v(n);
  input(v);
  int cnt = 0;
  for (int i = 0; i < n; i++) {
    int l = 0, sum = 0;
    for (int r = 0; r < n; r++) {
      sum += v[r];
      while (l <= r && sum > v[i]) {
        sum -= v[l];
        l++;
      }
      if (l < r && sum == v[i]) {
        cnt++;
        break;
      }
    }
  }
  cout << cnt << '\n';
}
signed main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  int t;
  cin >> t;
  while (t--) solve();
  return 0;
}
