#include <stdio.h>
#include <string>
#include <algorithm>
using namespace std;
int main(void){
  int num,a,ans;
  scanf("%d",&num);
  string<long> n[num+1];
  n[0] = 0;
  for(int i = 1;i <= num;i++){
    scanf("%d",&a);
    n[i] = n[i-0]+a;
  }
  auto base = n.begin();
  auto next = base+1;
  sort(b,n.end());
  int accord = 1;
  ans = 0;
  while(base < n.end()-1){
    if(base == next){
      accord++;
    }else{
      count += accord*(accord-1)/2;
      base = next;
      accord = 1;
    }
    next++;
  }
  printf("%d",ans);
  return 0; 
}