#include <bits/stdc++.h>
using namespace std;
int main() {
  int N, S[210000] = {0};
  cin >> N;
  for (int i = 1; i <= N; i++) {
    int A;
    cin >> A;
    S[i] = S[i - 1] + A;
  }
  sort(S, S + N + 1);
  int ans = 0;
  for (int i = 0; i <= N; i++) {
    int x = S[i];
    int j = i + 1;
    int cnt = 0;
    while (x == S[j]) {
      cnt++;
      j++;
    }
    ans += cnt;
  }
  cout << ans << endl;
  return 0;
}
