#include <bits/stdc++.h>
using namespace std;
const int MAX_N = 200000;
int N;
int A[MAX_N];
long long sums[MAX_N];
int solve() {
  int answer = 0;
  long long sum = 0;
  for (int i = (int)(0); i < (int)(N); i++) {
    sum += A[i];
    sums[i] = sum;
  }
  for (int i = (int)(0); i < (int)(N); i++) {
    for (int j = (int)(i); j < (int)(N); j++) {
      if (sums[j] - sums[i] + A[i] == 0) {
        answer++;
      }
    }
  }
  return answer;
}
signed main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cin >> N;
  for (int i = (int)(0); i < (int)(N); i++) cin >> A[i];
  cout << solve() << "\n";
}
