#include <bits/stdc++.h>
using namespace std;
int main() {
  int N;
  long long A[200001] = {};
  cin >> N;
  for (int i = 0; i < (N); i++) {
    int a;
    cin >> a;
    A[i + 1] = A[i] + a;
  }
  int count = 0;
  for (int i = 0; i < (N); i++)
    for (int j = (i + 1); j < (N + 1); j++)
      if (A[j] - A[i] == 0) count++;
  cout << count << endl;
  return 0;
}
