#include <bits/stdc++.h>
using namespace std;
int main() {
  int a;
  vector<long long> b;
  scanf("%d", &a);
  int count = 0;
  for (int i = 0; i < a; i++) {
    long long c;
    scanf("%lld", &c);
    b.push_back(c);
  }
  for (int i = 0; i < (int)b.size(); i++) {
    long long temp = 0;
    for (int j = i; j < (int)b.size(); j++) {
      temp += b[j];
      if (temp == 0) {
        count++;
      }
    }
  }
  printf("%d\n", count);
  return 0;
}
