#include <bits/stdc++.h>
using namespace std;
const int N = 2e5 + 10;
const int Max = 1e9 + 10;
map<long long, int> mp;
long long sum[10005];
long long arr[10005];
int main() {
  int n, ans;
  cin >> n;
  for (int i = 1; i <= n; i++) {
    cin >> arr[i];
    sum[i] = arr[i] + sum[i - 1];
    mp[sum[i]]++;
  }
  long long c = 0;
  for (int i = 0; i <= n; i++) {
    if (mp[sum[i]] > 0) {
      for (int j = i + 1; j <= n; j++)
        if (sum[j] == sum[i]) {
          c++;
        }
    }
    mp[sum[i]]--;
  }
  printf("%d\n", c);
  return 0;
}
