#include <bits/stdc++.h>
using namespace std;
using Graph = vector<vector<int>>;
const long long l_INF = 101010101000;
const int INF = 1010101010;
const int dx[4] = {-1, 0, 1, 0};
const int dy[4] = {0, -1, 0, 1};
using vi = vector<int>;
using vl = vector<long long>;
using vvi = vector<vi>;
using pii = pair<int, int>;
int main() {
  int n;
  cin >> n;
  vl a(n);
  for (int i = 0; i < n; i++) cin >> a[i];
  vl s(n + 1);
  long long count = 0;
  for (int i = 0; i < n; i++) s[i + 1] = s[i] + a[i];
  for (int i = 0; i < n + 1; i++) {
    for (int j = 0; j < i; j++) {
      if (s[i] - s[j] == 0) count++;
    }
  }
  cout << count << endl;
}
