#include <bits/stdc++.h>
using namespace std;
int main() {
  long long ans = 0, i = 0, j = 0, k = 0, l = 0;
  long long N, A[200] = {0}, b[210] = {0};
  cin >> N;
  for (i = 0; i < N; i++) {
    cin >> A[i];
    b[i + 1] = b[i] + A[i];
    if (b[i + 1] == 0) ans++;
  }
  sort(b + 1, b + N + 1);
  j = 1;
  for (i = 1; i < N + 1; i++) {
    if (b[i] == b[i + 1])
      j++;
    else {
      ans += j * (j - 1) / 2;
      j = 1;
    }
  }
  if (j == 1) ans += j * (j - 1) / 2;
  cout << ans << endl;
  return 0;
}
