#include <bits/stdc++.h>
using namespace std;
constexpr int64_t mod = 1e9 + 7;
int main() {
  int64_t n;
  cin >> n;
  std::vector<int64_t> a(n);
  for (int i = 0; i < n; ++i) {
    cin >> a[i];
  }
  int64_t cnt = 0;
  for (int i = 0; i < n; ++i) {
    int64_t sum = a[i];
    if (sum == 0) cnt++;
    for (int j = i + 1; j < n; ++j) {
      sum += a[j];
      if (sum == 0) cnt++;
    }
  }
  cout << cnt;
}
