#include <bits/stdc++.h>
using namespace std;
int main() {
  int N;
  cin >> N;
  vector<int> Subsum(N);
  for (int i = 0; i < N; i++) {
    int A;
    cin >> A;
    Subsum[i] = A + (i > 0 ? Subsum[i - 1] : 0);
  }
  int ans = 0;
  for (int i = 0; i < N; i++) {
    if (Subsum[i] == 0) ans++;
    for (int j = i + 1; j < N; j++)
      if (Subsum[j] - Subsum[i] == 0) ans++;
  }
  cout << ans << endl;
}
