#include <bits/stdc++.h>
using namespace std;
int main() {
  int count = 0;
  int N = 0;
  int sum[200000];
  cin >> N;
  for (int i = 0; i < (N); i++) {
    int value;
    cin >> value;
    if (i != 0) {
      sum[i] = sum[i - 1] + value;
    } else {
      sum[0] = value;
    }
    if (sum[i] == 0) {
      count++;
    }
  }
  for (int i = 0; i < (N); i++) {
    for (int j = i + 1; j < N; ++j) {
      if (sum[j] - sum[i] == 0) {
        count++;
      }
    }
  }
  cout << count;
  system("pause");
  return 0;
}
