#include <bits/stdc++.h>
using namespace std;
const long double PI = acos(-1.0);
int main() {
  int N;
  cin >> N;
  vector<long long> A(N);
  for (int i = 0; i < (int)(N); i++) cin >> A[i];
  int cnt = 0, right = 0;
  long long sum = 0;
  for (int left = 0; left < (int)(N); left++) {
    sum = 0;
    right = left;
    while (1) {
      sum += A[right];
      if (sum == 0) {
        cnt++;
        break;
      }
      right++;
      if (right == N) break;
    }
  }
  cout << cnt << endl;
  return 0;
}
