#include <stdio.h>
#include <stdlib.h>
int main(void){
    // Your code here!
    int N,i,j;
    scanf("%d",&N);
    int A[N];
    for(i=0;i<N;i++){
        scanf("%d",&A[i]);
    }
    //for(i=0;i<N;i++){
    //    if(A[i]==min)minC++;    
    //}
        int count = 0;
        int **dp;
        dp = malloc(sizeof(int *) * N);
        for(i=0;i<N;i++){
            dp[i] = malloc(sizeof(int)*N);
        }
        
        for(i=0;i<N;i++){
            dp[i][0] = A[i];
            //printf("%d ",dp[i][0]);
            for(j=1;j<N-i;j++){
                dp[i][j] = (dp[i][j-1] + A[i+j])% 1000000007;
                if(dp[i][j] == 0)count++;
                //printf("%d ",dp[i][j]);
            }
            //printf("\n");
        }
        printf("%d",count);
        free(dp);
    
}
