#include <bits/stdc++.h>
using namespace std;
int main() {
  int N;
  cin >> N;
  int a[N + 1];
  a[0] = 0;
  for (int i = 1; i <= N; i++) {
    int b;
    cin >> b;
    a[i] = a[i - 1] + b;
  }
  int ans = 0;
  for (int i = 0; i <= N; i++) {
    int standard = a[i];
    for (int j = i + 1; j <= N; j++) {
      if (standard == a[j]) ans++;
    }
  }
  cout << ans << endl;
  return 0;
}
