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