#include <bits/stdc++.h>
using namespace std;
int N;
int data[20000];
int t;
int cnt = 0;
int result = 0;
int main() {
  cin >> N;
  for (int i = 0; i < N; i++) {
    cin >> data[i];
  }
  for (int i = 0; i < N; i++) {
    for (int j = i; j < N; j++) {
      result += data[j];
      if (result == 0) {
        cnt++;
      }
    }
    result = 0;
  }
  cout << cnt;
}
