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