#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m;
  int sum = 0;
  int num[200000] = {0};
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) {
    scanf("%d", &m);
    num[i] = num[i - 1] + m;
    for (int j = i - 1; j >= 0; j--)
      if (num[j] == num[i]) sum++;
  }
  printf("%d", sum);
  return 0;
}
