#include <iostream>
using namespace std;
//a.cpp
int main(){
  int n,cnt = 0;
  cin >> n;
  //int a[n][n];
  int** a = new int*[n];
  for(int i = 0; i < n; i++){
    a[i] = new int[n];
  }
  
  for(int i = 0; i < n; i++){
    cin >> a[0][i];
  }

  for(int i = 1; i < n; i++){
    for(int j = 0; j < n-i; j++){
      a[i][j] = a[i-1][j]+a[0][j+i];
      //cout << a[i][j] << endl;
      if(a[i][j] == 0){
	cnt++;
      }
    }
  }

  cout << cnt << endl;