#include <bits/stdc++.h>
using namespace std;
int main() {
  int N;
  cin >> N;
  vector<int> A(N);
  vector<int> table(N, 0);
  for (int i = 0; i < N; i++) {
    cin >> A[i];
  }
  table[0] = A[0];
  for (int i = 0; i < N - 1; i++) {
    table[i + 1] = table[i] + A[i + 1];
  }
  int ans = 0;
  for (int l = 0; l < N; l++) {
    for (int r = l; r < N; r++) {
      int x = 0;
      if (l > 0) {
        x = table[l - 1];
      }
      if (table[r] == x) {
        ans++;
      }
    }
  }
  cout << ans << endl;
  return 0;
}
