#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
using vi = vector<int>;
const int mod = 1e9 + 7;
const long double pi = 3.141592653589793238462643383279502884197;
const long double eps = 1e-7;
int main() {
  int count = 0;
  int N = 0;
  int a[200000], sum[200000];
  cin >> N;
  for (int i = 0; i < (N); i++) {
    cin >> a[i];
    if (i != 0) {
      sum[i] = sum[i - 1] + a[i];
    } else {
      sum[0] = a[0];
    }
    if (sum[i] == 0) {
      count++;
    }
    for (int j = i + 1; j < N; ++j) {
      if (sum[j] - sum[i] == 0) {
        count++;
      }
    }
  }
  cout << count;
  system("pause");
  return 0;
}
