#include <stdio.h>
#include <stdlib.h>
int cmp(const int *a,const int *b){
  return *a-*b;
}
int main(){
  int i,n,a[200001]={0},b,c=0;
  scanf("%d",&n);
  for(i=1;i<=n;i++){
    scanf("%d",&b);
    a[i]=a[i-1]+b;
  }
  qsort(a,n,sizeof(int),cmp);
  for(i=1;i<n;i++)for(j=i+1;j<=n;j++)if(a[i]==a[j])c++;
  printf("%d",c);
  return 0;
}