#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  int t;
  cin >> t;
  while (t--) {
    int n;
    cin >> n;
    int arr[n], count1[10000] = {0}, count2 = 0;
    for (int i = 0; i < n; i++) {
      cin >> arr[i];
      count1[arr[i]]++;
    }
    for (int i = 0; i < n - 1; i++) {
      long long num = arr[i];
      for (int j = i + 1; j < n; j++) {
        num += arr[j];
        if (num <= n) {
          count2 += count1[num];
          count1[num] = 0;
        } else
          break;
      }
    }
    cout << count2 << "\n";
  }
}
