#include <bits/stdc++.h>
using namespace std;
long long a[2000005], s[2000005], ans;
int main() {
  int n;
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) {
    scanf("%lld", &a[i]);
    s[i] = s[i - 1] + a[i];
  }
  for (int i = 1; i <= n; i++)
    for (int j = 1; j <= i; j++)
      if (s[i] - s[j - 1] == 0) ans++;
  cout << ans;
  return 0;
}
