#include <bits/stdc++.h>
using namespace std;
bool sortbysec(const pair<long long int, long long int>& a,
               const pair<long long int, long long int>& b) {
  return (a.second < b.second);
}
bool comp(pair<long long int, pair<long long int, long long int>> a,
          pair<long long int, pair<long long int, long long int>> b) {
  if (a.first < b.first)
    return 1;
  else if (a.first > b.first)
    return 0;
  else {
    return a.second.first < b.second.first;
  }
}
long long int mpow(long long int x, long long int y) {
  long long int ans = 1;
  while (y) {
    if (y % 2 != 0) ans = (ans % LLONG_MAX) * (x % LLONG_MAX) % LLONG_MAX;
    y /= 2;
    x = ((x % LLONG_MAX) * (x % LLONG_MAX)) % LLONG_MAX;
  }
  return ans;
}
long long int modInverse(long long int n) { return mpow(n, LLONG_MAX - 2); }
long long int nCrModPFermat(long long int n, long long int r, long long int x,
                            long long int y, long long int z) {
  if (r == 0) return 1;
  return (x * modInverse(y) % LLONG_MAX * modInverse(z) % LLONG_MAX) %
         LLONG_MAX;
}
void bfs(vector<long long int> v[], long long int visit[], long long int s,
         long long int ans[]) {
  deque<long long int> q;
  q.push_back(s);
  visit[s] = 1;
  while (!q.empty()) {
    long long int x = q.front();
    q.pop_front();
    for (auto i = v[x].begin(); i != v[x].end(); i++) {
      if (!visit[*i]) {
        q.push_back(*i);
        visit[*i] = 1;
      }
    }
  }
}
void buildtree(int* tree, int* arr, int start, int end, int treeNode) {
  if (start < end) {
    int mid = start + (end - start) / 2;
    buildtree(tree, arr, start, mid, 2 * treeNode);
    buildtree(tree, arr, mid + 1, end, 2 * treeNode + 1);
    tree[treeNode] = tree[2 * treeNode] + tree[2 * treeNode + 1];
  }
}
void update(int* tree, int* arr, int start, int end, int pos, int val,
            int treeNode) {
  if (start == end)
    tree[treeNode] = val;
  else {
    int mid = start + (end - start) / 2;
    if (pos <= mid)
      update(tree, arr, start, mid, pos, val, 2 * treeNode);
    else
      update(tree, arr, mid + 1, end, pos, val, 2 * treeNode + 1);
    tree[treeNode] = tree[2 * treeNode] + tree[2 * treeNode + 1];
  }
}
void dfs(vector<long long int> v[], long long int visit[], long long int s,
         long long int c[], long long int ans[],
         map<long long int, long long int>* m, long long int pred[]) {
  visit[s] = 1;
  (*m)[c[s]]++;
  for (auto i = v[s].begin(); i != v[s].end(); i++) {
    if (!visit[*i]) {
      pred[*i] = s;
      dfs(v, visit, *i, c, ans, m, pred);
    }
  }
  if ((*m)[c[pred[s]]] == 1)
    ans[s] = (*m).size() - 1;
  else
    ans[s] = (*m).size();
}
vector<long long int> factor(long long int n) {
  vector<long long int> v;
  if (n % 2 == 0) {
    while (n % 2 == 0) {
      n /= 2;
      v.push_back(2);
    }
  }
  for (long long int i = 3; i <= sqrt(n); i += 2) {
    if (n % i == 0) {
      while (n % i == 0) {
        n /= i;
        v.push_back(i);
      }
    }
  }
  if (n > 1) v.push_back(n);
  return v;
}
int main() {
  long long int t, i, j, p = 0;
  cin >> t;
  while (t--) {
    long long int n;
    cin >> n;
    long long int a[n];
    for (i = 0; i < n; i++) cin >> a[i];
    vector<bool> v(n * n + 1, 0);
    for (i = 0; i < n; i++) {
      p = a[i];
      for (j = i + 1; j < n; j++) {
        p += a[j];
        v[p] = 1;
      }
    }
    p = 0;
    for (i = 0; i < n; i++) {
      if (v[a[i]]) p++;
    }
    cout << p;
    cout << endl;
  }
  return 0;
}
