#include <bits/stdc++.h>
using namespace std;
int main() {
  int t;
  cin >> t;
  while (t--) {
    int n;
    cin >> n;
    int arr[n];
    for (int i = 0; i < n; i++) {
      cin >> arr[i];
    }
    if (n == 1) {
      cout << 0 << "\n";
    } else {
      int ans = 0;
      for (int i = 0; i < n; i++) {
        int left = 0, right = 1;
        int tempsum = arr[left] + arr[right];
        while (right < n) {
          if (left == right) {
            if (right + 1 < n) {
              tempsum = tempsum + arr[right + 1];
              right = right + 1;
            } else {
              break;
            }
          }
          if (tempsum < arr[i]) {
            if (right + 1 < n) {
              tempsum = tempsum + arr[right + 1];
              right = right + 1;
            } else {
              break;
            }
          } else if (tempsum > arr[i]) {
            tempsum = tempsum - arr[left];
            left = left + 1;
          } else if (tempsum == arr[i]) {
            ans = ans + 1;
            break;
          }
        }
      }
      cout << ans << "\n";
    }
  }
}
