#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  vector<int> a(n);
  vector<long long> s(n + 1);
  s[0] = 0;
  for (int i = (0); i < (n); i++) {
    cin >> a[i];
    s[i + 1] = s[i] + a[i];
  }
  sort(s.begin(), s.end());
  int cou = 0;
  for (int i = (0); i <= (n); i++) {
    for (int j = (i + 1); j <= (n); j++) {
      if (s[i] != s[j]) {
        break;
      }
      cou++;
    }
  }
  cout << cou << endl;
  return 0;
}
