#include <bits/stdc++.h>
using namespace std;
const long long INF = (1LL << 60) - 1;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int t = 1;
  while (t--) {
    int n;
    cin >> n;
    int a[n];
    for (__typeof(n) i = (0) - ((0) > (n)); i != (n) - ((0) > (n));
         i += 1 - 2 * ((0) > (n)))
      cin >> a[i];
    int sum = 0, ans = 0;
    for (int i = 0; i < n - 1; i++) {
      sum = 0;
      sum += a[i];
      if (sum == 0) {
        ans++;
      }
      for (int j = i + 1; j < n; j++) {
        sum += a[j];
        if (sum == 0) {
          ans++;
        }
      }
    }
    cout << ans;
    cout << '\n';
  }
  return 0;
}
