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