#include <bits/stdc++.h>
using namespace std;
const int mod = 1000000007;
long long A[200010];
int main() {
  int N;
  cin >> N;
  for (int i = 0; i < N; i++) cin >> A[i];
  int an = 0;
  int num = 0;
  for (int i = 0; i < N; i++) {
    num = 0;
    for (int j = i; j < N; j++) {
      num += A[j];
      if (num == 0) an++;
    }
  }
  cout << an << endl;
}
