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